Depends on what exactly you are trying to do - e.g. for movement you could just adjust hspeed\vspeed and clamp it to (0, maxspeed) range like the game does. For shooting weapons, there's player_fire() function. Swapping weapons is just exchanging values of "wep" and "bwep" (and a few other variables like "reload", "breload" - see fields.gml).