setstat won't work
#1

i did this
pawn Код:
if(strcmp(cmd, "/setstat", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}USAGE:{FFFFFF} /setstat [playerid/PartOfName] [statcode] [amount]");
                SendClientMessage(playerid, COLOR_GRAD4, "|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                SendClientMessage(playerid, COLOR_GRAD3, "|6 PhoneNumber|8 HouseKey |9 BizKey |10 DonateRank");
                SendClientMessage(playerid, COLOR_GRAD2, "|11 FMember |12 FLeader |13 Playing hour |19 Box");
                SendClientMessage(playerid, COLOR_GRAD2, "|20 PassKey |21 VehKey1 |22 VehKey2 |23 VehKey3");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}USAGE:{FFFFFF} /setstat [playerid/PartOfName] [statcode] [amount]");
                        SendClientMessage(playerid, COLOR_GRAD4, "|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                        SendClientMessage(playerid, COLOR_GRAD3, "|6 PhoneNumber |8 HouseKey |9 BizKey |10 DonateRank");
                        SendClientMessage(playerid, COLOR_GRAD2, "|11 FMember |12 FLeader |13 Playing hour |19 Box");
                        SendClientMessage(playerid, COLOR_GRAD2, "|20 PassKey |21 VehKey1 |22 VehKey2 |23 VehKey3");
                        return 1;
                    }
                    new stat;
                    stat = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}USAGE:{FFFFFF} /setstat [playerid/PartOfName] [statcode] [amount]");
                        SendClientMessage(playerid, COLOR_GRAD4, "|2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                        SendClientMessage(playerid, COLOR_GRAD3, "|6 PhoneNumber |8 HouseKey |9 BizKey |10 DonateRank");
                        SendClientMessage(playerid, COLOR_GRAD2, "|11 FMember |12 FLeader |13 Playing hour |19 Box");
                        SendClientMessage(playerid, COLOR_GRAD2, "|20 PassKey |21 VehKey1 |22 VehKey2 |23 VehKey3");
                        return 1;
                    }
                    new amount;
                    amount = strval(tmp);
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    if (PlayerInfo[playerid][pAdmin] >= 1337)
                    {
                        switch (stat)
                        {
                            case 2:
                            {
                                PlayerInfo[giveplayerid][pSHealth] = amount;
                                format(string, sizeof(string), "%s has set %s spawn health to %d.", sendername,giveplayer,amount);
                            }
                            case 3:
                            {
                                PlayerInfo[giveplayerid][gPupgrade] = amount;
                                format(string, sizeof(string), "%s has set %s upgrade points to %d.", sendername,giveplayer,amount);
                            }
                            case 4:
                            {
                                PlayerInfo[giveplayerid][pModel] = amount;
                                format(string, sizeof(string), "%s has set %s model to %d.", sendername,giveplayer,amount);
                            }
                            case 5:
                            {
                                PlayerInfo[giveplayerid][pAccount] = amount;
                                format(string, sizeof(string), "%s has set %s bank money to %d.", sendername,giveplayer,amount);
                            }
                            case 6:
                            {
                                PlayerInfo[giveplayerid][pPnumber] = amount;
                                format(string, sizeof(string), "%s has set %s phone number to %d.", sendername,giveplayer,amount);
                            }
                            case 8:
                            {
                                PlayerInfo[giveplayerid][pPhousekey] = amount;
                                format(string, sizeof(string), "%s has set %s house key to %d.", sendername,giveplayer,amount);
                            }
                            case 9:
                            {
                                PlayerInfo[giveplayerid][pPbiskey] = amount;
                                format(string, sizeof(string), "%s has set %s business key to %d.", sendername,giveplayer,amount);
                            }
                            case 10:
                            {
                                PlayerInfo[giveplayerid][pDonateRank] = amount;
                                format(string, sizeof(string), "%s has set %s donate rank to %d.", sendername,giveplayer,amount);
                            }
                            case 11:
                            {
                                PlayerInfo[giveplayerid][pFMember] = amount;
                                format(string, sizeof(string), "%s has set %s family member to %d.", sendername,giveplayer,amount);
                            }
                            case 12:
                            {
                                PlayerInfo[giveplayerid][pFLeader] = amount;
                                format(string, sizeof(string), "%s has set %s family leader to %d.", sendername,giveplayer,amount);
                            }
                            case 13:
                            {
                                PlayerInfo[giveplayerid][pConnectTime] = amount;
                                format(string, sizeof(string), "%s has set %s playing hours to %d.", sendername,giveplayer,amount);
                            }
                            case 19:
                            {
                                PlayerInfo[giveplayerid][pBoxSkill] = amount;
                                format(string, sizeof(string), "%s has set %s box skill to %d.", sendername,giveplayer,amount);
                            }
                            case 21:
                            {
                                PlayerInfo[giveplayerid][pPcarkey] = amount;
                                format(string, sizeof(string), "%s has set %s veh key 1 to %d.", sendername,giveplayer,amount);
                            }
                            case 22:
                            {
                                PlayerInfo[giveplayerid][pPcarkey2] = amount;
                                format(string, sizeof(string), "%s has set %s veh key 2 to %d.", sendername,giveplayer,amount);
                            }
                            case 23:
                            {
                                PlayerInfo[giveplayerid][pPcarkey3] = amount;
                                format(string, sizeof(string), "%s has set %s veh key 3 to %d.", sendername,giveplayer,amount);
                            }
                            case 77:
                            {
                                PlayerInfo[giveplayerid][pJob] = amount;
                                format(string, sizeof(string), "%s has set %s job to %d.", sendername,giveplayer,amount);
                            }
                            case 88:
                            {
                                PlayerInfo[giveplayerid][pContractTime] = amount;
                                format(string, sizeof(string), "%s has set %s contract time to %d.", sendername,giveplayer,amount);
                            }
                            default:
                            {
                                SendClientMessage(playerid, COLOR_GRAD1, "   Invalid Stat Code");
                            }

                        }
                        SendClientMessage(playerid, COLOR_GRAD1, string);
                        SetStatLog(string);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                    }
                }//not valid id
            }//not connected
        }
        return 1;
    }
I type /setstat IG and nothing happend!
What to do?
Reply
#2

Try this.
pawn Код:
if(strcmp(cmd, "/setstat", true) == 0) {
        if(IsPlayerConnected(playerid)) {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
                SendClientMessage(playerid, COLOR_GRAD4, "|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                SendClientMessage(playerid, COLOR_GRAD3, "|6 PhoneNumber |7 RespectPoints |8 HouseKey |9 BizKey |10 DonateRank");
                SendClientMessage(playerid, COLOR_GRAD2, "|11 Member| 12 VehKey1 |13 VehKey2 |14 VehKey3| 15 Expire Date| 16 Job");
                SendClientMessage(playerid, COLOR_GRAD2, "|17 Job Delay| 18 Crimes |19 Arrestes | 20 Changes | 21 Donate Gate");
                SendClientMessage(playerid, COLOR_GRAD2, "|22 Furniture Locked|");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid)) {
                if(giveplayerid != INVALID_PLAYER_ID) {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp)) {
                        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
                        SendClientMessage(playerid, COLOR_GRAD4, "|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                        SendClientMessage(playerid, COLOR_GRAD3, "|6 PhoneNumber |7 RespectPoints |8 HouseKey |9 BizKey |10 DonateRank");
                        SendClientMessage(playerid, COLOR_GRAD2, "|11 Member| 12 VehKey1 |13 VehKey2 |14 VehKey3| 15 Expire Date| 16 Job");
                        SendClientMessage(playerid, COLOR_GRAD2, "|17 Job Delay| 18 Crimes |19 Arrestes | 20 Changes | 21 Donate Gate");
                        SendClientMessage(playerid, COLOR_GRAD2, "|22 Furniture Locked|");
                        return 1;
                    }
                    new stat;
                    stat = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp)) {
                        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
                        SendClientMessage(playerid, COLOR_GRAD4, "|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                        SendClientMessage(playerid, COLOR_GRAD3, "|6 PhoneNumber |7 RespectPoints |8 HouseKey |9 BizKey |10 DonateRank");
                        SendClientMessage(playerid, COLOR_GRAD2, "|11 Member| 12 VehKey1 |13 VehKey2 |14 VehKey3| 15 Expire Date| 16 Job");
                        SendClientMessage(playerid, COLOR_GRAD2, "|17 Job Delay| 18 Crimes |19 Arrestes | 20 Changes | 21 Donate Gate");
                        SendClientMessage(playerid, COLOR_GRAD2, "|22 Furniture Locked|");
                        return 1;
                    }
                    new amount;
                    amount = strval(tmp);
                    if (PlayerInfo[playerid][pAdmin] >= 10) {
                        switch (stat) {
                            case 1:
                            {
                                PlayerInfo[giveplayerid][pLevel] = amount;
                                format(string, sizeof(string), "   The Player Was Set To Level %d", amount);
                                SetPlayerScore(giveplayerid,amount);
                            }
                            case 2:
                            {
                                PlayerInfo[giveplayerid][pSHealth] = amount;
                                format(string, sizeof(string), "   The Player Was Set To %d Spawnhealth ", amount);
                            }
                            case 3:
                            {
                                PlayerInfo[giveplayerid][gPupgrade] = amount;
                                format(string, sizeof(string), "   The Player Was Set To %d Upgrade Points", amount);
                            }
                            case 4:
                            {
                                PlayerInfo[giveplayerid][pModel] = amount;
                                format(string, sizeof(string), "   The Player Was Set To Model %d", amount);
                            }
                            case 5:
                            {
                                PlayerInfo[giveplayerid][pAccount] = amount;
                                format(string, sizeof(string), "   The Player Account Was Set To $%d", amount);
                            }
                            case 6:
                            {
                                PlayerInfo[giveplayerid][pPnumber] = amount;
                                format(string, sizeof(string), "   The Player Phone Number Was Set To %d", amount);
                            }
                            case 7:
                            {
                                PlayerInfo[giveplayerid][pExp] = amount;
                                format(string, sizeof(string), "   The Player Respect Points Were Set To %d", amount);
                            }
                            case 8:
                            {
                                PlayerInfo[giveplayerid][pHousekey] = amount;
                                format(string, sizeof(string), "   The Player House Key Was Set To %d", amount);
                            }
                            case 9:
                            {
                                PlayerInfo[giveplayerid][pPbiskey] = amount;
                                format(string, sizeof(string), "   The Player Business Key Was Set To %d", amount);
                            }
                            case 10:
                            {
                                PlayerInfo[giveplayerid][pDonateRank] = amount;
                                format(string, sizeof(string), "   The Player DonateRank Was Set To %d", amount);
                            }
                            case 11:
                            {
                                if(amount > SCRIPT_CARS || amount < 0) {
                                    format(string, sizeof(string), "   Dont go below number 0, or above number %d!", SCRIPT_CARS);
                                    SendClientMessage(playerid, COLOR_GREY,string);
                                    return 1;
                                }
                                PlayerInfo[giveplayerid][pMember] = amount;
                                format(string, sizeof(string), "   The Player Family Member Was Set To %d", amount);
                            }
                            case 12:
                            {
                                if(amount > SCRIPT_CARS || amount < 0) {
                                    format(string, sizeof(string), "   Dont go below number 0, or above number %d!", SCRIPT_CARS);
                                    SendClientMessage(playerid, COLOR_GREY,string);
                                    return 1;
                                }
                                PlayerInfo[giveplayerid][pCarkey] = amount;
                                format(string, sizeof(string), "   The Player VehKey1 Set To %d", amount);
                            }
                            case 13:
                            {
                                if(amount > SCRIPT_CARS || amount < 0) {
                                    format(string, sizeof(string), "   Dont go below number 0, or above number %d!", SCRIPT_CARS);
                                    SendClientMessage(playerid, COLOR_GREY,string);
                                    return 1;
                                }
                                PlayerInfo[giveplayerid][pCarkey2] = amount;
                                format(string, sizeof(string), "   The Player VehKey2 Set To %d", amount);
                            }
                            case 14:
                            {
                                PlayerInfo[giveplayerid][pCarkey3] = amount;
                                format(string, sizeof(string), "   The Player VehKey3 Set To %d", amount);
                            }
                            case 15:
                            {
                                PlayerInfo[giveplayerid][pDonateTime] = amount;
                                format(string, sizeof(string), "   The Player Expire Date Set To %d", amount);
                            }
                            case 16:
                            {
                                PlayerInfo[giveplayerid][pJob] = amount;
                                format(string, sizeof(string), "   The Player Job Set To %d", amount);
                            }
                            case 17:
                            {
                                JobDelay[giveplayerid] = amount;
                                format(string, sizeof(string), "   The Player Job Delay Set To %d", amount);
                            }
                            case 18:
                            {
                                PlayerInfo[giveplayerid][pCrimes] = amount;
                                format(string, sizeof(string), "   The Player Crimes Set To %d", amount);
                            }
                            case 19:
                            {
                                PlayerInfo[giveplayerid][pArrested] = amount;
                                format(string, sizeof(string), "   The Player Arrested Set To %d", amount);
                            }
                            case 20:
                            {
                                PlayerInfo[giveplayerid][pChanges] = amount;
                                format(string, sizeof(string), "   The Player Changes Set To %d", amount);
                            }
                            case 21:
                            {
                                PlayerInfo[giveplayerid][pDonerGate1] = amount;
                                format(string, sizeof(string), "   The Player Donate Gate ID Set To %d", amount);
                            }
                            case 22:
                            {
                                PlayerInfo[giveplayerid][pFurnLocked] = amount;
                                format(string, sizeof(string), "   The Player Furniture Locked Set To %d", amount);
                            }
                            default:
                            {
                                format(string, sizeof(string), "   Invalid Stat Code", amount);
                            }

                        }
                        SendClientMessage(playerid, COLOR_GRAD1, string);
                    }
                    else {
                        SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                    }
                }                                 // Not valid ID
            }                                     //Not connected
        }
        return 1;
    }
Reply
#3

I dont using Plevel playing hour it's my level
Reply
#4

Well, change it to your variables ?
Reply
#5

What you mean i just want fix it
Reply
#6

anyone
Reply
#7

PHP код:
if(strcmp(cmd"/setstatevg2648"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD1"USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
                
SendClientMessage(playeridCOLOR_GRAD4"|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                
SendClientMessage(playeridCOLOR_GRAD3"|6 PhoneNumber |7 RespectPoints |8 HouseKey |9 BizKey |10 DonateRank");
                
SendClientMessage(playeridCOLOR_GRAD2"|11 Member| 12 VehKey1 |13 VehKey2 |14 VehKey3| 15 Expire Date| 16 Job");
                
SendClientMessage(playeridCOLOR_GRAD2"|17 Job Delay| 18 Crimes |19 Arrestes | 20 Changes | 21 Donate Gate");
                
SendClientMessage(playeridCOLOR_GRAD2"|22 Furniture Locked|");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if(
IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                    
tmp strtok(cmdtextidx);
                    if(!
strlen(tmp))
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
                        
SendClientMessage(playeridCOLOR_GRAD4"|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                        
SendClientMessage(playeridCOLOR_GRAD3"|6 PhoneNumber |7 RespectPoints |8 HouseKey |9 BizKey |10 DonateRank");
                        
SendClientMessage(playeridCOLOR_GRAD2"|11 Member| 12 VehKey1 |13 VehKey2 |14 VehKey3| 15 Expire Date| 16 Job");
                        
SendClientMessage(playeridCOLOR_GRAD2"|17 Job Delay| 18 Crimes |19 Arrestes | 20 Changes | 21 Donate Gate");
                        
SendClientMessage(playeridCOLOR_GRAD2"|22 Furniture Locked|");
                        return 
1;
                    }
                    new 
stat;
                    
stat strval(tmp);
                    
tmp strtok(cmdtextidx);
                    if(!
strlen(tmp))
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
                        
SendClientMessage(playeridCOLOR_GRAD4"|1 Level |2 SpawnHealth |3 UpgradePoints |4 Model |5 BankAccount");
                        
SendClientMessage(playeridCOLOR_GRAD3"|6 PhoneNumber |7 RespectPoints |8 HouseKey |9 BizKey |10 DonateRank");
                        
SendClientMessage(playeridCOLOR_GRAD2"|11 Member| 12 VehKey1 |13 VehKey2 |14 VehKey3| 15 Expire Date| 16 Job");
                        
SendClientMessage(playeridCOLOR_GRAD2"|17 Job Delay| 18 Crimes |19 Arrestes | 20 Changes | 21 Donate Gate");
                        
SendClientMessage(playeridCOLOR_GRAD2"|22 Furniture Locked|");
                        return 
1;
                    }
                    new 
amount;
                    
amount strval(tmp);
                    if (
PlayerInfo[playerid][pAdmin] >= 5)
                    {
                        switch (
stat)
                        {
                                                    case 
2:
                            {
                                
PlayerInfo[giveplayerid][pSHealth] = amount;
                                
format(stringsizeof(string), "%s has set %s spawn health to %d."sendername,giveplayer,amount);
                            }
                            case 
3:
                            {
                                
PlayerInfo[giveplayerid][gPupgrade] = amount;
                                
format(stringsizeof(string), "%s has set %s upgrade points to %d."sendername,giveplayer,amount);
                            }
                            case 
4:
                            {
                                
PlayerInfo[giveplayerid][pModel] = amount;
                                
format(stringsizeof(string), "%s has set %s model to %d."sendername,giveplayer,amount);
                            }
                            case 
5:
                            {
                                
PlayerInfo[giveplayerid][pAccount] = amount;
                                
format(stringsizeof(string), "%s has set %s bank money to %d."sendername,giveplayer,amount);
                            }
                            case 
6:
                            {
                                
PlayerInfo[giveplayerid][pPnumber] = amount;
                                
format(stringsizeof(string), "%s has set %s phone number to %d."sendername,giveplayer,amount);
                            }
                            case 
8:
                            {
                                
PlayerInfo[giveplayerid][pPhousekey] = amount;
                                
format(stringsizeof(string), "%s has set %s house key to %d."sendername,giveplayer,amount);
                            }
                            case 
9:
                            {
                                
PlayerInfo[giveplayerid][pPbiskey] = amount;
                                
format(stringsizeof(string), "%s has set %s business key to %d."sendername,giveplayer,amount);
                            }
                            case 
10:
                            {
                                
PlayerInfo[giveplayerid][pDonateRank] = amount;
                                
format(stringsizeof(string), "%s has set %s donate rank to %d."sendername,giveplayer,amount);
                            }
                            case 
11:
                            {
                                
PlayerInfo[giveplayerid][pFMember] = amount;
                                
format(stringsizeof(string), "%s has set %s family member to %d."sendername,giveplayer,amount);
                            }
                            case 
12:
                            {
                                
PlayerInfo[giveplayerid][pFLeader] = amount;
                                
format(stringsizeof(string), "%s has set %s family leader to %d."sendername,giveplayer,amount);
                            }
                            case 
13:
                            {
                                
PlayerInfo[giveplayerid][pConnectTime] = amount;
                                
format(stringsizeof(string), "%s has set %s playing hours to %d."sendername,giveplayer,amount);
                            }
                            case 
19:
                            {
                                
PlayerInfo[giveplayerid][pBoxSkill] = amount;
                                
format(stringsizeof(string), "%s has set %s box skill to %d."sendername,giveplayer,amount);
                            }
                            case 
21:
                            {
                                
PlayerInfo[giveplayerid][pPcarkey] = amount;
                                
format(stringsizeof(string), "%s has set %s veh key 1 to %d."sendername,giveplayer,amount);
                            }
                            case 
22:
                            {
                                
PlayerInfo[giveplayerid][pPcarkey2] = amount;
                                
format(stringsizeof(string), "%s has set %s veh key 2 to %d."sendername,giveplayer,amount);
                            }
                            case 
23:
                            {
                                
PlayerInfo[giveplayerid][pPcarkey3] = amount;
                                
format(stringsizeof(string), "%s has set %s veh key 3 to %d."sendername,giveplayer,amount);
                            }
                            case 
77:
                            {
                                
PlayerInfo[giveplayerid][pJob] = amount;
                                
format(stringsizeof(string), "%s has set %s job to %d."sendername,giveplayer,amount);
                            }
                            case 
88:
                            {
                                
PlayerInfo[giveplayerid][pContractTime] = amount;
                                
format(stringsizeof(string), "%s has set %s contract time to %d."sendername,giveplayer,amount);
                            }
                            default:
                            {
                                
format(stringsizeof(string), "   Invalid Stat Code"ammount);
                            }

                        }
                        
SendClientMessage(playeridCOLOR_GRAD1string);
                        
SetStatLog(string);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
                    }
                }
//not valid id
            
}//not connected
        
}
        return 
1;
    } 
Try this.
Reply
#8

C:\Program Files\San Andreas\сшбш\gamemodes\M-RP.pwn(29422) : error 017: undefined symbol "ammount"
Reply
#9

in beginning of command ( near tmp = strtok(cmdtext,idx); )
pawn Код:
new ammount;
Reply
#10

Quote:
Originally Posted by CmZxC
Посмотреть сообщение
in beginning of command ( near tmp = strtok(cmdtext,idx); )
pawn Код:
new ammount;
Its not ammount but amount.
And i thought that bumping wasn't allowed?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)