[HELP] ZCMD Issue
#1

Hey,

This command will not work. It's ment to allow a cop or firefight to type the command then a players ID and send the repsonse message to them.....


pawn Код:
COMMAND:res(playerid,giveplayerid,params[])
{
if(PlayerTeam[playerid] == Team_Fire || PlayerTeam[playerid] == Team_EMS || PlayerTeam[playerid] == Team_Sheriff || PlayerTeam[playerid] == Team_LVPD)
if(PlayerTeam[playerid] == Team_Civ) return SendClientMessage(playerid,COLOR_YELLOW,"[INFO]: Un-Authorised Command Attempt!");
new string[128];
new sendername[MAX_PLAYER_NAME];
//***** Sent to Civ ****
format(string, sizeof(string),"[CALL]: A call from 911: A unit Has Been Dispatched to investigate your call, Please stay where you are");
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
// **** Police Radio ***
format(string,sizeof(string),"[911]: Unit %s reponding to %s's Call, Over",sendername,giveplayerid);
SendMessageToLaw(string);
// *** End ****
return 1;
}
Reply
#2

Use sscanf to format the params.
Reply
#3

No Idea how to......
Reply
#4

pawn Код:
COMMAND:res(playerid,giveplayerid,params[])
{
new pID,  string[128];
// restricted teams here
if(PlayerTeam[playerid] == Team_Civ) return SendClientMessage(playerid,COLOR_YELLOW,"[INFO]: Un-Authorised Command Attempt!");
if(sscanf(params, "u", pID)) return SendClientMessage(playerid,COLOR_YELLOW,"[USAGE]: /res [ playerid / name ]");
format(string, sizeof(string),"[CALL]: A call from 911: A unit Has Been Dispatched to investigate your call, Please stay where you are");
SendClientMessage(pID,COLOR_YELLOW,string);
format(string,sizeof(string),"[911]: Unit %d reponding to %d's Call, Over",playerid, pID);
SendMessageToLaw(string);
return 1;
}
Reply
#5

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
pawn Код:
COMMAND:res(playerid,giveplayerid,params[])
{
new pID,  string[128];
// restricted teams here
if(PlayerTeam[playerid] == Team_Civ) return SendClientMessage(playerid,COLOR_YELLOW,"[INFO]: Un-Authorised Command Attempt!");
if(sscanf(params, "u", pID)) return SendClientMessage(playerid,COLOR_YELLOW,"[USAGE]: /res [ playerid / name ]");
format(string, sizeof(string),"[CALL]: A call from 911: A unit Has Been Dispatched to investigate your call, Please stay where you are");
SendClientMessage(pID,COLOR_YELLOW,string);
format(string,sizeof(string),"[911]: Unit %d reponding to %d's Call, Over",playerid, pID);
SendMessageToLaw(string);
return 1;
}
Didnt work, Displays The Text But not the players name.
Reply
#6

Quote:
Originally Posted by [UG]Scripter
Посмотреть сообщение
Didnt work, Displays The Text But not the players name.
I've just included the id's as i got no clue how you get the player's name, if you use a stock or whatever ..

pawn Код:
stock GetPlayerNameEx(playerid) // This is how i do it.
{
     new pName[25];
     GetPlayerName(playerid, pName, sizeof(pName));
     return pName;
}
Now just change pID and playerid in your command to: GetPlayerNameEx(pID) & GetPlayerNameEx(playerid)
Reply
#7

have you in any way altered the native zcmd function to allow for the 'giveplayerid' variable to be present in the function definition?
pawn Код:
CMD:res(playerid,params[])
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)