Use strcmp to compare the parameter after your command.
pawn Код:
COMMAND:fly(playerid, params[])
{
new pname[MAX_PLAYER_NAME];
new id;
if(!strcmp(params, "playground", true)) // Checking if params is playground
{
SetPlayerPos(playerid, xpos, ypos, zpos); // Change them with your location's x y z
}
else if(!strcmp(params, "ls", true))
{
// Same stuff, if you want to add more, do what I did.
}
else if(sscanf(params,"u",id)) SendClientMessage(playerid, COLOR_ORANGE, "/fly <id> OR /fly <place>"); /*Takes the ID you entered and makes it the "id" we defined. If no ID is entered the error message shows up*/
{
if(playerid == id) return SendClientMessage(playerid, COLOR_RED, "You can't teleport to yourself..."); /*Checks if the player id entered is not yours and if it is it shows the error message*/
else
{
if(!IsPlayerConnected(id)) SendClientMessage(playerid, COLOR_WHITE, "Player is Not Online"); /*Checks if the ID entered is a player that is online in the server, otherwise sends the error message*/
else
{
new Float:x,Float:y,Float:z;
SetPlayerPos(playerid,x,y,z+100);
//Defines the x,y, and z co-ordinates of the target player
GetPlayerPos(id,Float:x,Float:y,Float:z);//Sets what the x,y, and z means
GetPlayerName(id,pname,sizeof(pname)); //Gets the name of the player that is to be teleported to
SetPlayerPos(playerid,x,y,z+425);//Teleports the admin to the player's x,y, and z co-ordinates we set earlier
GivePlayerWeapon(playerid, 46, 1);
}
}
}
return 1;
}
I added to your usage message "OR /fly <place>" just so the player knows he can teleport to players and places.