22.02.2015, 05:50
First Of All Put Include Zcmd And sscanf On Top Script :
Then Second Thing Is Making Goto Command :
Now Let Make The Function
"u" = for playerid
"d" = for number
"s" = for word
"f" = for float
"!" = Mean Not
If You Delete ! It Mean IsPlayerConnected If You Put ! It Mean If Player Not Connected
It Mean If You're Trying To Use The Command To Your Self It Will Be Nothing
To Get Player Position
If You Want Car Also Can Follow The Player
Then Put Else If Without Car
Then Put return 1; for close the function
Ok Done
Full Command
Quote:
#include <zcmd> #include <sscanf2> |
Quote:
CMD:goto(playerid, params[]) { return 1; } |
Quote:
new pID; if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "/Goto [Playerid]"); |
"d" = for number
"s" = for word
"f" = for float
Quote:
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "Player Is Not Connected!") |
If You Delete ! It Mean IsPlayerConnected If You Put ! It Mean If Player Not Connected
Quote:
if(pID == playerid) return 0; |
Quote:
new Float: x, Float:y, Float:z; GetPlayerPos(pID, x, y, z); |
Quote:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(GetPlayerVehicleID(playerid), x+2, y, z); LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0); SetCameraBehindPlayer(playerid); } |
Then Put Else If Without Car
Quote:
else { SetPlayerPos(playerid, x+2, y, z); SetCameraBehindPlayer(playerid); } |
Quote:
return 1; } |
Full Command
Quote:
CMD:goto(playerid, params[]) { new pID; if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "/Goto [Playerid]"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "That user is not connected."); if(pID == playerid) return 0; new Float: x, Float:y, Float:z; GetPlayerPos(pID, x, y, z); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(GetPlayerVehicleID(playerid), x+2, y, z); LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0); SetCameraBehindPlayer(playerid); } else { SetPlayerPos(playerid, x+2, y, z); SetCameraBehindPlayer(playerid); } return 1; } |