Set Score Command
#10

Try this: replace:
pawn Code:
if(strcmp(cmd, "/setscore", true) == 0)
    {
    new sendername[MAX_PLAYER_NAME];
    new tmp[256];
    new tmp2[256];
    tmp = strtok(cmdtext, idx);
    new givenplayer = strval(tmp);
    tmp2 = strtok(cmdtext, idx);
    new score = strval(tmp2);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setscore [playerid] [Score]");
    if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invaild player ID!");
    SetPlayerScore(givenplayer,score);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "Admin \"%s\" has just set your score to %d!", sendername, score);
    SendClientMessage(otherplayer, COLOR_GREEN, string);
    return 1;
    }
With this:
pawn Code:
if(strcmp(cmd, "/setscore", true) == 0)
{
    new sand;
    new targetid, score, sendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"ui", targetid, score)) return SendClientMessage(playerid, 0xFFFFFFF, "USAGE: /SetScore [PlayerID] [Score]");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFF, "Error: Your not Admin!");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF, "Error: This Player isnt Connected!");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(targetid, receivername,sizeof(receivername));
    format(string, sizeof(string),"Your Score been setted to %d by admin %s", score, sendername);
    SendClientMessage(targetid, 0xFFFFFF, string);
    format(string, sizeof(string),"Admin %s Setted your score to %d", receivername, score);
    SendClientMessage(targetid, sand, string);
    SetPlayerScore(playerid, score);
    return 1;
}
If you get errors after replacing thorse try to post them here and we can see if we can fix them, i think this should work, and on top of your game mode search for #include <sscanf> if you don't have that you must add #include <sscanf> below #include <a_samp> but you must download the sscanf include and put it in pawno/includes folder.
Reply


Messages In This Thread
Set Score Command - by Patrick - 29.09.2012, 20:44
Re: Set Score Command - by xMCx - 29.09.2012, 20:47
Re: Set Score Command - by Patrick - 29.09.2012, 20:49
Re: Set Score Command - by KingHual - 29.09.2012, 20:50
Re: Set Score Command - by Patrick - 29.09.2012, 20:51
Re: Set Score Command - by xMCx - 29.09.2012, 20:52
Re: Set Score Command - by Patrick - 29.09.2012, 20:54
Re: Set Score Command - by gnoomen2 - 29.09.2012, 21:06
Re: Set Score Command - by Patrick - 29.09.2012, 21:11
Re: Set Score Command - by gnoomen2 - 30.09.2012, 11:20

Forum Jump:


Users browsing this thread: 2 Guest(s)