Here:
pawn Код:
CMD:teleplayer(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You're not authorized to use this command."); // change this to your own admin variable that you're using
new giveplayerid, place[50];
if(sscanf(params, "us[50]", giveplayerid, place))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Correct usage: /teleplayer [playerid/name] [place]");
SendClientMessage(playerid, 0xFFFFFFFF, "Available places are: bank, lspd"); // add your own here
return 1;
}
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Error: Player not connected.");
if(strcmp(place, "bank"))
{
SetPlayerPos(giveplayerid, 0.0, 0.0, 0.0); // replace the 0.0's with the bank's X Y and Z
}
else if(strcmp(place, "lspd"))
{
SetPlayerPos(giveplayerid, 0.0, 0.0, 0.0); // replace the 0.0's with the lspd's X Y and Z
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Error: Invalid teleport place.");
SendClientMessage(playerid, 0xFFFFFFFF, "Available places are: bank, lspd"); // add your own here
}
return 1;
}
To add more places, you simply add this:
pawn Код:
else if(strcmp(place, "newplace"))
{
SetPlayerPos(giveplayerid, 0.0, 0.0, 0.0); // replace the 0.0's with the new place's X Y and Z
}
Underneath the last else if, so then it'd look like this:
pawn Код:
CMD:teleplayer(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0; // change this to your own admin variable that you're using
new giveplayerid, place[50];
if(sscanf(params, "us[50]", giveplayerid, place))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Correct usage: /teleplayer [playerid/name] [place]");
SendClientMessage(playerid, 0xFFFFFFFF, "Available places are: bank, lspd"); // add your own here
return 1;
}
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Error: Player not connected.");
if(strcmp(place, "bank"))
{
SetPlayerPos(giveplayerid, 0.0, 0.0, 0.0); // replace the 0.0's with the bank's X Y and Z
}
else if(strcmp(place, "lspd"))
{
SetPlayerPos(giveplayerid, 0.0, 0.0, 0.0); // replace the 0.0's with the lspd's X Y and Z
}
else if(strcmp(place, "newplace"))
{
SetPlayerPos(giveplayerid, 0.0, 0.0, 0.0); // replace the 0.0's with the new place's X Y and Z
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Error: Invalid teleport place.");
SendClientMessage(playerid, 0xFFFFFFFF, "Available places are: bank, lspd"); // add your own here
}
return 1;
}