SA-MP Forums Archive
/pu command, urgent! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /pu command, urgent! (/showthread.php?tid=498379)



/pu command, urgent! - Mriss - 03.03.2014

I need a /pu [id] command [Pull Over]
It will Send a message to the ID that has been asked to pull over...
The Message will say

Officer %s: Has Asked You to Pull Over Immediately.
the %s will be the Name
This Is my gTeam thing
pawn Код:
if(gTeam[playerid] == TEAM_COPS)



Re: /pu command, urgent! - CutX - 03.03.2014

pawn Код:
//you have to define the colors for yourself ofc.
//can't just copy that n' go usin' it :P
YCMD:pu(playerid, params[], help)
{
    if(help) return SendClientMessage(playerid, gray, "You can ask a criminal suspectto pull over using /pu [ID]");
    new id;
    if(sscanf(params,"d",id)) return SendClientMessage(playerid,red,"USAGE: /pu [ID]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Invalid ID!");
    if(!GetPlayerWantedLevel(id)) return SendClientMessage(playerid,red,"That's not a criminal suspect!");
    new s[81],pn[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pn,MAX_PLAYER_NAME);
    format(s,sizeof s,"Police Officer %s[%d] has asked you to PULL OVER, NOW!",pn,playerid);
    SendClientMessage(id,blue,s);
    GetPlayerName(id,pn,MAX_PLAYER_NAME);
    format(s,sizeof s,"You've asked %s[%d] to pull over.",pn,id);
    SendClientMessage(playerid,white,s);
    return 1;
}
since we're using YCMD here, we can use

pawn Код:
if(gTeam[playerid] == TEAM_COPS)
    Command_SetPlayerNamed("pu", playerid, true);
to 'assign' that command to the police class.put that in class selection or onplayerspawn, idk! wherever you like
Like this, no other class will be able to use it or even see that
such a command exists :P


Re: /pu command, urgent! - Mriss - 03.03.2014

ZCMD please?


Re: /pu command, urgent! - LocMax - 03.03.2014

pawn Код:
CMD:pu(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, red, "/pu [playerid]");
    if(strval(params) == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Invalid ID!");
    if(!GetPlayerWantedLevel(strval(params))) return SendClientMessage(playerid,red,"That's not a criminal suspect!");
    new s[81],pn[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pn,MAX_PLAYER_NAME);
    format(s,sizeof s,"Police Officer %s[%d] has asked you to PULL OVER, NOW!",pn,playerid);
    SendClientMessage(strval(params),blue,s);
    GetPlayerName(strval(params),pn,MAX_PLAYER_NAME);
    format(s,sizeof s,"You've asked %s[%d] to pull over.",pn,strval(params));
    SendClientMessage(playerid,white,s);
    return 1;
}
It's CutX's code, I just changed it