[WHATS WRONG]Command bugged
#1

Код:
			else if(strcmp(x_nr,"deliver",true) == 0)
			{
			    if(PlayerToPoint(3.0,playerid,-2119.5469,-178.5679,35.3203))
			    {
			        new packets = PlayerInfo[playerid][pMaterialsPack];
       				tmp = strtok(cmdtext, idx);
			        if(!strlen(tmp)) {
						SendClientMessage(playerid, COLOR_WHITE, "USAGE: /materials deliver [ammount]");
						return 1;
					}
					packets = strval(tmp);
			        if(PlayerInfo[playerid][pMaterialsPack] >= 0)
			        {
			            new payout = 10 * packets;
			            format(string, sizeof(string), "* Factory gave you %d materials for yours %d materials pack.", payout ,packets);
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            PlayerInfo[playerid][pMaterials] += payout;
			            PlayerInfo[playerid][pMaterialsPack] -= packets;
			        }
			        else
			        {
			            SendClientMessage(playerid, COLOR_GREY, "You dont have more materials pack!");
				        return 1;
			        }
			    }
			    else
			    {
			        SendClientMessage(playerid, COLOR_GREY, "You are not at factory!");
			        return 1;
			    }
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Invalid name!");
			    return 1;
			}
		}
		return 1;
	}
When I type /materials deliver 2, but I have only 2 materials, money are going into minus[-] and gives me materials..
Reply
#2

It should work like this:
pawn Код:
PlayerInfo[playerid][pMaterials] = PlayerInfo[playerid][pMaterials]+payout;
PlayerInfo[playerid][pMaterialsPack] = PlayerInfo[playerid][pMaterialsPack]-packets;
Reply
#3

Quote:
Originally Posted by Amel_PAtomAXx
Посмотреть сообщение
It should work like this:
pawn Код:
PlayerInfo[playerid][pMaterials] = PlayerInfo[playerid][pMaterials]+payout;
PlayerInfo[playerid][pMaterialsPack] = PlayerInfo[playerid][pMaterialsPack]-packets;
No, its not working...
Reply
#4

Anyone to help? :/
Reply
#5

for what is ppaketti = strval(tmp); ? you're not using that
Reply
#6

Quote:
Originally Posted by Jefff
Посмотреть сообщение
for what is ppaketti = strval(tmp); ? you're not using that
Forgot to change..its ok its packets
Reply
#7

Anyone to helpppp? :O
Reply
#8

Quote:
Originally Posted by Connor Smith
Посмотреть сообщение
Anyone to helpppp? :O
Please?
Reply
#9

Quote:
Originally Posted by Connor Smith
Посмотреть сообщение
Код:
			else if(strcmp(x_nr,"deliver",true) == 0)
			{
			    if(PlayerToPoint(3.0,playerid,-2119.5469,-178.5679,35.3203))
			    {
			        new packets = PlayerInfo[playerid][pMaterialsPack];
       				tmp = strtok(cmdtext, idx);
			        if(!strlen(tmp)) {
						SendClientMessage(playerid, COLOR_WHITE, "USAGE: /materials deliver [ammount]");
						return 1;
					}
					packets = strval(tmp);
			        if(PlayerInfo[playerid][pMaterialsPack] >= 0)
			        {
			            new payout = 10 * packets;
			            format(string, sizeof(string), "* Factory gave you %d materials for yours %d materials pack.", payout ,packets);
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            PlayerInfo[playerid][pMaterials] += payout;
			            PlayerInfo[playerid][pMaterialsPack] -= packets;
			        }
			        else
			        {
			            SendClientMessage(playerid, COLOR_GREY, "You dont have more materials pack!");
				        return 1;
			        }
			    }
			    else
			    {
			        SendClientMessage(playerid, COLOR_GREY, "You are not at factory!");
			        return 1;
			    }
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Invalid name!");
			    return 1;
			}
		}
		return 1;
	}
When I type /materials deliver 2, but I have only 2 materials, money are going into minus[-] and gives me materials..
HELP please!
Reply
#10

Quote:
Originally Posted by Connor Smith
Посмотреть сообщение
Код:
			else if(strcmp(x_nr,"deliver",true) == 0)
			{
			    if(PlayerToPoint(3.0,playerid,-2119.5469,-178.5679,35.3203))
			    {
			        new packets = PlayerInfo[playerid][pMaterialsPack];
       				tmp = strtok(cmdtext, idx);
			        if(!strlen(tmp)) {
						SendClientMessage(playerid, COLOR_WHITE, "USAGE: /materials deliver [ammount]");
						return 1;
					}
					packets = strval(tmp);
			        if(PlayerInfo[playerid][pMaterialsPack] >= 0)
			        {
			            new payout = 10 * packets;
			            format(string, sizeof(string), "* Factory gave you %d materials for yours %d materials pack.", payout ,packets);
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			            PlayerInfo[playerid][pMaterials] += payout;
			            PlayerInfo[playerid][pMaterialsPack] -= packets;
			        }
			        else
			        {
			            SendClientMessage(playerid, COLOR_GREY, "You dont have more materials pack!");
				        return 1;
			        }
			    }
			    else
			    {
			        SendClientMessage(playerid, COLOR_GREY, "You are not at factory!");
			        return 1;
			    }
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Invalid name!");
			    return 1;
			}
		}
		return 1;
	}
When I type /materials deliver 2, but I have only 2 materials, money are going into minus[-] and gives me materials..
HELP please
Reply


Forum Jump:


Users browsing this thread: