/makeleader command
#1

That's my unfinished command.
PHP код:
CMD:dajlidera(playeridparams[])
{
    new 
podaneid;
    new 
numer;
    new 
tmp[256];
    
numer strval(tmp);
    if(
sscanf(params"u"podaneid)) return SendClientMessage(playeridcolorRed"Use /dajlidera");
    if(
podaneid == INVALID_PLAYER_ID) return SendClientMessage(playeridcolorRed"Wrong player id.");
    
format(file128"/SRP/%s.ini"GetName(podaneid));
    
dini_IntSet(file"Frakcja"numer);
    return 
1;

I want to set player i select ((podaneid)) a faction of my choice. ((/dajlidera [id] [faction id]))
I'm using ZCMD and i don't know how to do it without cmdtext and other things.
Can someone just fix this code?
Reply
#2

pawn Код:
CMD:dajlidera(playerid, params[])
{
    new id,faction;
    if(sscanf(params,"ud",id,faction)) return SendClientMessage(playerid,colorred,"USAGE: /dajilidera [playerid] [factionid]");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,colorre,"ERROR: Disconnected player!");
    format(file, 128, "/SRP/%s.ini", GetName(id));
    dini_IntSet(file, "Frakcja", faction);
    return 1;
}
sscanf is very useful while trying to script multiple parameters commands
Reply
#3

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)