SA-MP Forums Archive
[Support Needed] Need Help Badly ;) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Support Needed] Need Help Badly ;) (/showthread.php?tid=130268)



[Support Needed] Need Help Badly ;) - Platanito - 26.02.2010

alright im doing this for my RP server but i cant manage how to get it working some things are not defined but i dont know how to define them correctly :/

Код:
	if(strcmp(cmd, "/stash", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /stash [Mats/Drugs] [amount]");
				return 1;
			}
			new dmat[256];
			dmat = strtok(cmdtext, idx);
	    if(!strlen(dmat))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /stash [Mats/Drugs] [amount*]");
				return 1;
			}
			new pstate,VID;
			pstate = GetPlayerState(playerid);
			VID = GetPlayerVehicleID(playerid);
			if(IsPlayerInAnyVehicle(playerid))
			{
			  if(pstate == 2)
			  {
					if(strcmp(dmat, "mats", true) == 0)
					{
					  moneys = strval(tmp);
					  if(PlayerInfo[playerid][pMats] < 1)
					  {
					    SendClientMessage(playerid, COLOR_GRAD1, " You dont have Materials !");
					    return 1;
						}
						if(PlayerInfo[playerid][pMats] < moneys)
						{
   						SendClientMessage(playerid, COLOR_GRAD1, " You dont have that many Materials !");
					    return 1;
						}
						if(PlayerInfo[playerid][pMats] >= moneys)
						{
						  PlayerInfo[playerid][pMats] -= moneys;
						  carmats[VID] += moneys;
						  format(string,sizeof(string), " You have stashed %d Materials in the car (CARID:%d)", moneys, VID);
              SendClientMessage(playerid, COLOR_GREEN, string);
						}
					}
					if(strcmp(dmat, "drugs", true) == 0)
					{
            moneys = strval(tmp);
					  if(PlayerInfo[playerid][pDrugs] < 0)
					  {
					    SendClientMessage(playerid, COLOR_GRAD1, " You dont have Drugss !");
					    return 1;
						}
						if(PlayerInfo[playerid][pDrugs] < moneys)
						{
   						SendClientMessage(playerid, COLOR_GRAD1, " You dont have that many Drugss !");
					    return 1;
						}
						if(PlayerInfo[playerid][pDrugs] >= moneys)
						{
						  PlayerInfo[playerid][pDrugs] -= moneys;
						  cardrugs[VID] += moneys;
						  format(string,sizeof(string), " You have stashed %d Drugs in the car (CARID:%d)", moneys, VID);
              SendClientMessage(playerid, COLOR_GREEN, string);
						}
					}
				}
				else
				{
				  SendClientMessage(playerid, COLOR_GRAD1, " You are not the Driver !");
				  return 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GRAD1, " You aren't in a Car !");
			  return 1;
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/retrieve", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /retrieve [Mats/Drugs/Check] [amount]");
				return 1;
			}
			new dmat[256];
			new pstate,VID;
			pstate = GetPlayerState(playerid);
			VID = GetPlayerVehicleID(playerid);
			dmat = strtok(cmdtext, idx);
	    if(!strlen(dmat))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /stash [Mats/Drugs/Check] [amount*]");
				return 1;
			}
			if(IsPlayerInAnyVehicle(playerid))
			{
			  if(pstate == 2)
			  {
			    tmp = strtok(cmdtext, idx);
					if(strcmp(dmat, "mats", true) == 0)
					{
					  moneys = strval(tmp);
					  if(carmats[VID] < 1)
					  {
					    SendClientMessage(playerid, COLOR_GRAD1, " No Materials Stashed !");
					    return 1;
						}
						if(carmats[VID] < moneys)
						{
   						SendClientMessage(playerid, COLOR_GRAD1, " The Car doesnt have that many Materials !");
					    return 1;
						}
						if(carmats[VID] >= moneys)
						{
						  PlayerInfo[playerid][pMats] += moneys;
						  carmats[VID] -= moneys;
						  format(string,sizeof(string), " You have Retrieved %d Materials in the car (CARID:%d)", moneys, VID);
              SendClientMessage(playerid, COLOR_GREEN, string);
						}
					}
					if(strcmp(dmat, "drugs", true) == 0)
					{
            moneys = strval(tmp);
					  if(cardrugs[VID] < 0)
					  {
					    SendClientMessage(playerid, COLOR_GRAD1, " You dont have Drugss !");
					    return 1;
						}
						if(cardrugs[VID] < moneys)
						{
   						SendClientMessage(playerid, COLOR_GRAD1, " You dont have that many Drugss !");
					    return 1;
						}
						if(cardrugs[VID] >= moneys)
						{
						  PlayerInfo[playerid][pDrugs] += moneys;
						  cardrugs[VID] -= moneys;
						  format(string,sizeof(string), " You have Retrieved %d Drugs in the car (CARID:%d)", moneys, VID);
              SendClientMessage(playerid, COLOR_GREEN, string);
						}
					}
				}
				else
				{
				  SendClientMessage(playerid, COLOR_GRAD1, " You are not the Driver !");
				  return 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GRAD1, " You aren't in a Car !");
			  return 1;
			}
		}
		return 1;
	}

And it appears this thing

Код:
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12353) : error 017: undefined symbol "cmd"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12357) : error 017: undefined symbol "tmp"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12357) : error 017: undefined symbol "idx"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12358) : error 017: undefined symbol "tmp"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12364) : error 017: undefined symbol "idx"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12379) : error 017: undefined symbol "moneys"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12379) : error 017: undefined symbol "tmp"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12385) : error 017: undefined symbol "moneys"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12390) : error 017: undefined symbol "moneys"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12392) : error 017: undefined symbol "moneys"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12393) : error 017: undefined symbol "carmats"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12393) : warning 215: expression has no effect
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12393) : error 001: expected token: ";", but found "]"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12393) : error 029: invalid expression, assumed zero
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12393) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


14 Errors.
I'm doing it in a LARP edit and it supposed to stash drugs and material inside a vehicle i would like some help badly thanks and its really apreciated


Re: Need Help Badly ;) - Platanito - 26.02.2010

im trying to add this to my gm but cant find the way to do it with the define things


Re: Need Help Badly ;) - bajskorv123 - 26.02.2010

Add this under OnPlayerCommandText
pawn Код:
new tmp[128], moneys, carmats
new cmd[128], idx;
cmd = strtok(cmdtext, idx);



Re: Need Help Badly ;) - VonLeeuwen - 26.02.2010

new tmp[128], moneys, carmats;
new cmd[128], idx;
cmd = strtok(cmdtext, idx);

That, you forgot a ;, Hannes


Re: Need Help Badly ;) - Platanito - 26.02.2010

Alright thaks guys btw do i put this under OnPlayerCommandText? or in the new think at the begining of the script btw OnPlayerCommandText i already got

Код:
new cmd[256];
	new tmp[256];
	new giveplayerid, moneys, idx;
	new idcar = GetPlayerVehicleID(playerid);
	new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
	cmd = strtok(cmdtext, idx);
Should i replace this parameters? or should i just Add them? Thanks for the info


Re: Need Help Badly ;) - Klutty - 26.02.2010

Add.


Re: Need Help Badly ;) - Platanito - 26.02.2010

Alright added it but i get many errors in 1 line

Код:
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : error 028: invalid subscript (not an array or too many subscripts): "carmats"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : warning 215: expression has no effect
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : error 001: expected token: ";", but found "]"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : error 029: invalid expression, assumed zero
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.


This is the Line

Код:
						  carmats[VID] += moneys;



Re: Need Help Badly ;) - bajskorv123 - 26.02.2010

Quote:
Originally Posted by Platanito
Alright added it but i get many errors in 1 line

Код:
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : error 028: invalid subscript (not an array or too many subscripts): "carmats"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : warning 215: expression has no effect
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : error 001: expected token: ";", but found "]"
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : error 029: invalid expression, assumed zero
C:\Users\Vegueta\Downloads\GTARP\gamemodes\gtarp.pwn(12396) : fatal error 107: too many error messages on one line
This is the Line

Код:
carmats[VID] += moneys;
May i see your new/define for carmats?
(at the top of your script you know)


Re: Need Help Badly ;) - Platanito - 26.02.2010

you mean the

new carmats

or the

#Define CAR_Mats




PD: im trying to add this to my script but i forgot to make a
new carmats

should i make something like

Код:
new carmats[MAX_PLAYERS];



Re: Need Help Badly ;) - VonLeeuwen - 26.02.2010

Both