dcmd_enablegoto(playerid,params[])
{
#pragma unused params
enablegoto[playerid] = 1;
return 1;
}
dcmd_egoto(playerid,params[])
{
#pragma unused params
new id,string[100],pName[MAX_PLAYER_NAME],pName2[MAX_PLAYER_NAME];
if(enablegoto[id] == 0) return SendClientMessage(playerid,red,"ERROR: That player has goto disabled");
GetPlayerPos(id,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
GetPlayerName(id,pName2,sizeof(pName2));
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"||Teleported to %s||",pName2);
SendClientMessage(playerid,grey,string);
format(string,sizeof(string),"||%s has teleported to your position||",pName);
SendClientMessage(id,grey,string);
return 1;
}
new id;
dcmd_me(playerid,params[])
{
new text[128],Playername[MAX_PLAYER_NAME]; // will create a text string with 128 cells (= maximum) and a Playername with maximum name input.
if(!sscanf(params,"s",text))
{
new string[128]; // will create a new string with 128 cells.
GetPlayerName(playerid,Playername,sizeof(Playername)); // will get players name and store it in Playername.
format(string,sizeof(string),"%s %s",Playername,text); // First %s = Playername... Second %d = text
SendClientMessageToAll(COLOR_WHITE,string); // Sends the text!
}
else return SendClientMessage(playerid,COLOR_RED,"Syntax Error: /me 'text'."); // if the player did not type the things correctly.
return 1;
}
sscanf: use this. It will be pretty simple to use. Please note you need the plugin or the code to use :P
Example: pawn Код:
|
dcmd_egoto(playerid,params[])
{
new string[100], pName[25], pName2[25];
if(!strlen(params)) return SendClientMessage(playerid,red,"USSAGE: /goto [id]");
else if(enablegoto[id] == 0) return SendClientMessage(playerid,red,"ERROR: That player has goto disabled");
else if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid,red,"Player not connected");
else
{
GetPlayerPos(strval(params),X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
GetPlayerName(strval(params),pName2,25);
GetPlayerName(playerid,25);
format(string,100,"||Teleported to %s||",pName2);
SendClientMessage(playerid,grey,string);
format(string,100,"||%s has teleported to your position||",pName);
SendClientMessage(strval(params),grey,string);
}
return 1;
}