SA-MP Forums Archive
Simple problem - 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: Simple problem (/showthread.php?tid=321374)



Simple problem - SnG.Scot_MisCuDI - 26.02.2012

I know this will be solved within a second but im trying to make a /win cmd where you type /win (id) (prize)
So /win 1 dildo
It wont give them the prize but it announces it to all the players it did

pawn Код:
CMD:win(playerid, params[])
{
if(!IsPlayerLuxAdmin(playerid))
    {
        return SendClientMessage(playerid, -1, "SERVER: Unknown Command.");
    }
    else
    {
        new id, name[MAX_PLAYER_NAME],str[128],string[128];
        if(sscanf(params, "u", id, string)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /win <id> <prize>");
        GetPlayerName(id, name, sizeof(name));
        format(str,sizeof(str), "~R~%s ~w~has won the event~n~and %s",name,string);
        GameTextForAll(str,6000,3);
    }
return 1;
}
its showing like this
http://i.imgur.com/FkI3f.png
http://i.imgur.com/12oop.png


Re: Simple problem - Lynn - 26.02.2012

pawn Код:
CMD:win(playerid, params[])
{
    if(!IsPlayerLuxAdmin(playerid))
    {
        return SendClientMessage(playerid, -1, "SERVER: Unknown Command.");
    }
    else
    {
        new id, name[MAX_PLAYER_NAME],str[128],string[32];
        if(sscanf(params, "us[32]", id, string)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /win <id> <prize>");
        GetPlayerName(id, name, sizeof(name));
        format(str,sizeof(str), "~R~%s ~w~has won the event~n~and %s",name,string);
        GameTextForAll(str,6000,3);
    }
    return 1;
}
You forgot to add the string(s[32] too
pawn Код:
f(sscanf(params, "us[32]", id, string)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /win <id>
Also 128 string is too big, so I decreased it to 32.


Re: Simple problem - SnG.Scot_MisCuDI - 26.02.2012

Thansks.. +rep