SA-MP Forums Archive
Need little help - 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: Need little help (/showthread.php?tid=388377)



Need little help - IceBilizard - 28.10.2012

guyz i have a problem with a cmd i made tow cmds 1 /givemark and /showmarks
/givemark works perfect but /showmarks have a prob if i type /showmarks 0
then its show this player got 91 role play marks please help me and fix the /showmarks cmd
here is the code of those cmds

1-/givemark
pawn Код:
if(strcmp(cmd, "/givemark", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /givemark [playerid/PartOfName] [amount of marks]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                            SCM(playerid, COLOR_GRAD1, "USAGE: /givemark [playerid/PartOfName] [amount of marks]");
                            return 1;

                    }
                    new amount;
                    amount = strval(tmp);
                    if (PlayerInfo[playerid][pTeacher] >= 1)
                    {
                        PlayerInfo[giveplayerid][pMarks] = amount;
                        GetPlayerName(playerid, numewarning, sizeof(numewarning));
                        format(string, sizeof(string), "[Teacher]: %s Has give you %d Roleplay mark(s).",numewarning,amount,giveplayerid);
                        ABroadCast(COLOR_LIGHTRED,string, 5);
                    }
                    else
                    {
                        SCM(playerid, COLOR_RED, "   You are not a RolePlay Teacher!");
                    }
                }//not valid id
            }//not connected
        }
        return 1;
    }
2-/showmarks
pawn Код:
if(strcmp(cmd, "/showmarks", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /showmarks [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new amount;
                    amount = strval(tmp);
                    PlayerInfo[giveplayerid][pMarks] = amount;
                    GetPlayerName(playerid, numewarning, sizeof(numewarning));
                    format(string, sizeof(string), "This Player Has %d Roleplay mark(s).",numewarning,amount,giveplayerid);
                    ABroadCast(COLOR_LIGHTRED,string, 5);
                }//not valid id
            }//not connected
        }
        return 1;
    }



Re: Need little help - zyghy - 28.10.2012

Код:
if(strcmp(cmd, "/showmarks", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /showmarks [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new amount;
                    amount = strval(tmp);
                    PlayerInfo[giveplayerid][pMarks] = amount;
                    GetPlayerName(playerid, numewarning, sizeof(numewarning));
                    format(string, sizeof(string), "%s Has %d Roleplay mark(s) to %s.",numewarning,amount,giveplayerid);
                    ABroadCast(COLOR_LIGHTRED,string, 5);
                }//not valid id
            }//not connected
        }
        return 1;
    }
try this !


Re: Need little help - IceBilizard - 28.10.2012

Not works


Re: Need little help - zyghy - 28.10.2012

OR
Код:
if(strcmp(cmd, "/showmarks", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /showmarks [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new amount;
                    amount = strval(tmp);
                    PlayerInfo[giveplayerid][pMarks] = amount;
                    GetPlayerName(playerid, numewarning, sizeof(numewarning));
                    format(string, sizeof(string), "This Player Has %d Roleplay mark(s).",amount);
                    ABroadCast(COLOR_LIGHTRED,string, 5);
                }//not valid id
            }//not connected
        }
        return 1;
    }



Re: Need little help - IceBilizard - 28.10.2012

now says this player have 0 rp marks but i have 7


Re: Need little help - zyghy - 28.10.2012

Код:
if(strcmp(cmd, "/showmarks", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /showmarks [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new amount;
                    amount = strval(tmp);
                    PlayerInfo[giveplayerid][pMarks] = amount;
                    GetPlayerName(playerid, numewarning, sizeof(numewarning));
                    format(string, sizeof(string), "This Player Has %d Roleplay mark(s).", PlayerInfo[giveplayerid][pMarks]);
                    ABroadCast(COLOR_LIGHTRED,string, 5);
                }//not valid id
            }//not connected
        }
        return 1;
    }
try this


Re: Need little help - IceBilizard - 28.10.2012

Nope Same prob ;(


Re: Need little help - zyghy - 28.10.2012

add id cubase.samp and you give me teamviewer and i help you in 20minutes (messenger)


Re: Need little help - IceBilizard - 28.10.2012

If you have skype the add me shehrozassad


Re: Need little help - IceBilizard - 29.10.2012

Ok thanks for help now finally i create correct code

pawn Код:
if(strcmp(cmd, "/showmarks", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /showmarks [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if (PlayerInfo[playerid][pMarks] >= 1)
                    {
                        GetPlayerName(playerid, numewarning, sizeof(numewarning));
                        format(string, sizeof(string), "This Player have %d Roleplay mark(s).", PlayerInfo[playerid][pMarks]);
                        ABroadCast(COLOR_LIGHTRED,string, 5);
                    }
                    else
                    {
                        SCM(playerid, COLOR_RED, "   You Didn't have rp marks!");
                    }
                    format(string, sizeof(string), "You showed you'r RolePlay Marks to %s",numewarning);
                    ABroadCast(COLOR_LIGHTRED,string, 5);
                }//not valid id
            }//not connected
        }
        return 1;
    }