/switch - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /switch (
/showthread.php?tid=64051)
/switch -
AgentE420 - 01.02.2009
Okay, I need this one command set, ive tried to write it a few times but failed. heres what i want to do. i dont know how to use the floats.
/switch id
allow player to /switch places with another player.
i think the only exception would be if player is in vehicle.
only TEAM_AGENT can use this command
please help this is my last command to add to release my version on a perm server.
Re: /switch -
AgentE420 - 01.02.2009
ok heres what i got so far, but it only take you to the player, i need it to take the player back to where he WAS.
also, he cant do this on TEAM_AGENT , TEAM_NEO, TEAM_SMITH
Code:
if(strcmp(cmd, "/switch", true == 0) && gTeam[playerid] == TEAM_AGENT )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /switch (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /switch (id) ID Must be a number");
return 1;
}
if (IsPlayerConnected(giveplayerid)) {
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
new Float:x, Float:y, Float:z;
new pname[24];
new aname[24];
GetPlayerPos(giveplayerid, x,y,z);
SetPlayerPos(playerid, x+1,y,z);
GetPlayerName(giveplayerid, pname, 24);
GetPlayerName(playerid, aname, 24);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Special Ability Used_|");
format(string, sizeof(string), "You have teleported to %s(%d)",pname,giveplayerid);
SendClientMessage(playerid,0xFF7F50AA, string);
format(string, sizeof(string), "%s(%d) has teleported to %s(%d) [ABILITY COMMAND /SWITCH]",aname,playerid,pname,giveplayerid);
printf("%s", string);
}
else {
format(string, sizeof(string), "ID (%d) Is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
}
return 1;
}