SA-MP Forums Archive
Control system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Control system (/showthread.php?tid=631260)



Control system - silverms - 26.03.2017

hey so is there a way to make the player control player I have this system but it isn't workin
:
PHP код:
CMD:pmhcontrol(playeridparams[])
{
    if(
adlvl(playerid)<3) return 0;
    new 
pid;
    if(
sscanf(params,"i",pid)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /control [playerid]");
    
TogglePlayerSpectating(playerid1);
    
PlayerSpectatePlayer(playeridpid);
    
SendClientMessage(playerid0xFF0000FF"Control the player using W,S,A,D!");
    
CallLocalFunction("lel""dd"playeridpid);
    
SetTimerEx("lel"1true"i"playerid);
    
SetPlayerFacingAngle(pid0);
    
control[playerid] = 1;
    return 
1;
}
public 
lel(playeridid)
{
    if(
control[playerid] == 1) {
    new 
Keys,ud,lr;
    
GetPlayerKeys(playerid,Keys,ud,lr);
    if(
ud == KEY_UP) return SetPlayerVelocity(id0.20.00.0);
    else if(
ud == KEY_DOWN) return SetPlayerVelocity(id, -0.20.00.0);
    if(
lr == KEY_LEFT) return SetPlayerVelocity(id0.00.20.0);
    else if(
lr == KEY_RIGHT) return SetPlayerVelocity(id0.0, -0.20.0); }
    return 
1;




Re: Control system - J0sh... - 26.03.2017

You should do that with
PHP код:
public OnPlayerUpdate(playerid
and not a timer.


Re: Control system - silverms - 26.03.2017

thanks