Posts: 20
Threads: 0
Joined: Sep 2014
Quote:
CMD:goto(playerid, params[])
{
new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");//checks if you have written something after /goto if no it sends error
else if(!IsPlayerConnected(id) || id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player you are teleporting to is connected or if it is yourself if yes then comes an error
else//ELSE what will happen if no errors
{
new Float, Float:y, Float:z;//creates new floats
GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
SetPlayerPos(playerid, x+1, y+1, z);//sets the player position the id of that player +1 in x +1 in y and z remains same as it defines height
}
return 1;
}
|
+REP me if i helped you.
Posts: 20
Threads: 0
Joined: Sep 2014
pawn Код:
YCMD:goto(playerid, params[], help)
{
* * if(help)
* * {
* * * * SendClientMessage(playerid, -1, "SF | LS | LV");
* * * * SendClientMessage(playerid, -1, "/goto [Location");
* * }
* * switch ( YHash( params ), false ) //parameter | YHash(str[], bool:sensitive = true, e_HASH_TYPE:type = bernstein);
* * {
* * * * case _H<LS>:
* * * * {
* * * * * * //ls coordinates.
* * * * }
* * * * case _H<LV>:
* * * * {
* * * * * * //lv coordinates.
* * * * }
* * * * case _H<SF>:
* * * * {
* * * * * * //sf coordinates.
* * * * }
* * }
* * return 1;
}