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