Advertisement
Youssef_Ehab

Untitled

May 29th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. COMMAND:goto(playerid, params[])
  2. {
  3. 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
  4. if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");//checks if you have written something after /goto if no it sends error
  5. else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "You can't teleport to that player right now!");
  6. if(GotoDisabled[ID] == 1)
  7. {
  8. new string[50], name[MAX_PLAYER_NAME];
  9. format(string, sizeof(string), "%s's goto is disabled!", GetPlayerName(playerid, name, sizeof(name)));
  10. GameTextForPlayer(playerid,string,2000,3);
  11. return 1;
  12. }
  13. else//ELSE what will happen if no errors
  14. {
  15. if(IsPlayerInVehicle(playerid, vehicleid))
  16. {
  17. new player;
  18. new Float:x, Float:y, Float:z;//creates new floats
  19. SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
  20. LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player));
  21. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player));
  22. }
  23. else
  24. {
  25. new Float:x, Float:y, Float:z;//creates new floats
  26. 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
  27. 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
  28. }
  29. }
  30. return 1;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement