SA-MP Forums Archive
[WHATS WRONG]Command bugged - 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: [WHATS WRONG]Command bugged (/showthread.php?tid=521663)



[WHATS WRONG]Command bugged - Connor Smith - 24.06.2014

Код:
			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..


Re: [WHATS WRONG]Command bugged - Amel_PAtomAXx - 24.06.2014

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



Re: [WHATS WRONG]Command bugged - Connor Smith - 24.06.2014

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...


Re: [WHATS WRONG]Command bugged - Connor Smith - 24.06.2014

Anyone to help? :/


Re: [WHATS WRONG]Command bugged - Jefff - 24.06.2014

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


Re: [WHATS WRONG]Command bugged - Connor Smith - 25.06.2014

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


Re: [WHATS WRONG]Command bugged - Connor Smith - 26.06.2014

Anyone to helpppp? :O


Re: [WHATS WRONG]Command bugged - Connor Smith - 27.06.2014

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



Re: [WHATS WRONG]Command bugged - Connor Smith - 30.06.2014

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!


Re: [WHATS WRONG]Command bugged - Connor Smith - 04.07.2014

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