Error with /equip
#1

Hello i get this errors after doing this command,
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(21827) : error 006: must be assigned to an array
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(22023) : error 006: must be assigned to an array
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

This is line 21827 : itemtwo = strrest(cmdtext,idx);
This is line 22023 : itemtwo = strrest(cmdtext,idx);
2 Errors.
Код:
	if(strcmp(cmd, "/equip", true) == 0)
	{
	  new item;
		new itemtwo;
	  if(IsPlayerConnected(playerid))
	  {
		if(PlayerToPoint(100, playerid, 244.9618,-1348.2435,107.1833) || PlayerToPoint(3,playerid,266.5720,118.6626,1004.6172))//centerpoint 24-7
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /equip [playerid/PartOfName] [item number]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(!IsPlayerConnected(giveplayerid))
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /equip [playerid/PartOfName] [item number]");
				SendClientMessage(playerid, COLOR_BLUE, "|_______ LSPD Police Armory _______|");
				SendClientMessage(playerid, COLOR_GRAD1, "| 1: Deagle & Spray		2: MP5");
				SendClientMessage(playerid, COLOR_GRAD2, "| 3: M4 & Smoke Grenades	4: Shotgun");
				SendClientMessage(playerid, COLOR_GRAD3, "| 5: Standard SWAT	6: Medium SWAT");
				SendClientMessage(playerid, COLOR_GRAD4, "| 7: Heavy SWAT		8: Sharpshooter SWAT");
				SendClientMessage(playerid, COLOR_GRAD5, "| 9: Equip Armor+health   10: Ceremonial Uniform");
				SendClientMessage(playerid, COLOR_GRAD5, "| 11: Default ((WARNING: It kills you))");
				return 1;
			}
			new id = strval(tmp);
			itemtwo = strrest(cmdtext,idx);
			item = itemtwo;
				if (item == 1)
				{
				  if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
				  {
					  if (PlayerInfo[playerid][pRank] > 2)
						{
							SafeGivePlayerWeapon(id, 3, 1);
							SafeGivePlayerWeapon(id, 24, 400);
							SafeGivePlayerWeapon(id, 41, 1000);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has taken Deagle & Spray", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
				  }
  				}
				else if (item == 2)
				{
				  if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pLeader] == 1)
				  {
					  if (PlayerInfo[playerid][pRank] > 2)
						{
							SafeGivePlayerWeapon(id, 3, 1);
							SafeGivePlayerWeapon(id, 29, 600);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has taken SMG/MP5", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 3)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
		  			if (PlayerInfo[playerid][pRank] > 2)
						{
						  SendClientMessage(id, COLOR_WHITE, "Dont spray everone near you using this equipment");
						  SafeGivePlayerWeapon(id, 17, 20);
						  SafeGivePlayerWeapon(id, 31, 400);
							GetPlayerName(id, sendername, sizeof(sendername));
	 						format(string, sizeof(string), "* %s has taken M4 & Smoke grenades", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 4)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
						SafeGivePlayerWeapon(id, 3, 1);
						SafeGivePlayerWeapon(id, 24, 400);
						SafeGivePlayerWeapon(id, 41, 999);
						SetPlayerSkin(id, 284);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has put on safety gear and equipment for motorcycle use and patrol.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 5)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
						SafeResetPlayerWeapons(id);
					  SafeGivePlayerWeapon(id, 3, 1);
					  SafeGivePlayerWeapon(id, 24, 400);
					  SafeGivePlayerWeapon(id, 41, 999);
					  SafeGivePlayerWeapon(id, 17, 5);
				  	SafeGivePlayerWeapon(id, 29, 600);
						SetPlayerSkin(id, 285);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has put on a SWAT uniform and geared up with standard equipment.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 6)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
						SafeResetPlayerWeapons(id);
					  SafeGivePlayerWeapon(id, 3, 1);
					  SafeGivePlayerWeapon(id, 24, 400);
					  SafeGivePlayerWeapon(id, 41, 999);
					  SafeGivePlayerWeapon(id, 17, 5);
				  	SafeGivePlayerWeapon(id, 31, 600);
 		 				SetPlayerSkin(id, 285);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has put on a SWAT uniform and geared up with medium equipment.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 7)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
			  			  SafeResetPlayerWeapons(id);
						  SafeGivePlayerWeapon(id, 3, 1);
						  SafeGivePlayerWeapon(id, 24, 400);
						  SafeGivePlayerWeapon(id, 41, 999);
						  SafeGivePlayerWeapon(id, 16, 5);
						  SafeGivePlayerWeapon(id, 27, 100);
							SetPlayerSkin(id, 285);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has put on a SWAT uniform and geared up with heavy equipment.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 8)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
						  SafeResetPlayerWeapons(id);
						  SafeGivePlayerWeapon(id, 3, 1);
						  SafeGivePlayerWeapon(id, 23, 400);
						  SafeGivePlayerWeapon(id, 34, 50);
							SetPlayerSkin(id, 285);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has put on a SWAT uniform and geared up with sharpshooter equipment.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 9)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
							SetPlayerArmour(id, 100);
	  	        SetPlayerHealth(id, 100);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s places on a Kevlar vest and eats some donuts.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					  }
					}
				}
				else if (item == 10)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
							SafeResetPlayerWeapons(id);
						  SafeGivePlayerWeapon(id, 3, 1);
				  		 	SafeGivePlayerWeapon(id, 23, 400);
					  	SafeGivePlayerWeapon(id, 33, 50);
							SetPlayerSkin(id, 288);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has put on a ceremonial uniform and equipment.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
						else if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pRank] > 3)
						{
						  SafeResetPlayerWeapons(id);
						  SafeGivePlayerWeapon(id, 3, 1);
				  		 	SafeGivePlayerWeapon(id, 23, 400);
					  	SafeGivePlayerWeapon(id, 33, 50);
					  	SetPlayerSkin(id, 283);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has put on a ceremonial uniform and equipment.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 11)
				{
				  new originalskin = PlayerInfo[id][pModel];
					SetPlayerSkin(id, originalskin);
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "  You don't have the cash for that!");
					return 1;
				}
			}
			if(PlayerToPoint(100, playerid, 222.6434,115.1870,999.0156))//centerpoint 24-7
	    {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /equip [playerid/PartOfName] [item number]");
					SendClientMessage(playerid, COLOR_BLUE, "|_______ LSPD Police Armory _______|");
					SendClientMessage(playerid, COLOR_GRAD1, "| 1: Deagle & Spray		2: MP5");
					SendClientMessage(playerid, COLOR_GRAD2, "| 3: M4 & Smoke grenades	4: Shotgun");
					SendClientMessage(playerid, COLOR_GRAD3, "| 5: Standard SWAT	6: Medium SWAT");
					SendClientMessage(playerid, COLOR_GRAD4, "| 7: Heavy SWAT		8: Sharpshooter SWAT");
					SendClientMessage(playerid, COLOR_GRAD5, "| 9: Equip Armor+health   10: Ceremonial Uniform");
					SendClientMessage(playerid, COLOR_GRAD5, "| 11: Default ((WARNING: It kills you))");
					return 1;
				}
				new id = strval(tmp);
				itemtwo = strrest(cmdtext,idx);
				item = itemtwo;
				if (item == 1)
				{
				  if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
				  {
						SafeGivePlayerWeapon(id, 24, 400);
						SafeGivePlayerWeapon(id, 3, 1);
						SafeGivePlayerWeapon(id, 41, 1000);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has taken a Deagle & a Spray can", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				  }
  				}
				else if (item == 2)
				{
				  if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
				  {
						SafeGivePlayerWeapon(id, 29, 600);
						SafeGivePlayerWeapon(id, 3, 1);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has taken a MP5.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 3)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
						  SafeGivePlayerWeapon(id, 31, 400);
					   	SafeGivePlayerWeapon(id, 17, 20);
							GetPlayerName(id, sendername, sizeof(sendername));
	 						format(string, sizeof(string), "* %s has taken M4 & Smoke grenades", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 4)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
						SafeGivePlayerWeapon(id, 25, 100);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has taken a shotgun.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 5)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
						SafeResetPlayerWeapons(playerid);
					  SafeGivePlayerWeapon(id, 3, 1);
					  SafeGivePlayerWeapon(id, 24, 400);
					  SafeGivePlayerWeapon(id, 41, 999);
					  SafeGivePlayerWeapon(id, 17, 5);
				  	SafeGivePlayerWeapon(id, 29, 600);
						SetPlayerSkin(id, 285);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has put on a tactical uniform and geared up with standard equipment.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 6)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
						SafeResetPlayerWeapons(id);
					  SafeGivePlayerWeapon(id, 3, 1);
					  SafeGivePlayerWeapon(id, 24, 400);
					  SafeGivePlayerWeapon(id, 41, 999);
					  SafeGivePlayerWeapon(id, 17, 5);
				  	SafeGivePlayerWeapon(id, 31, 600);
 	 					SetPlayerSkin(id, 285);
						GetPlayerName(id, sendername, sizeof(sendername));
						format(string, sizeof(string), "* %s has put on a tactical uniform and geared up with medium equipment.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 7)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
		  				  SafeResetPlayerWeapons(id);
						  SafeGivePlayerWeapon(id, 3, 1);
						  SafeGivePlayerWeapon(id, 24, 400);
						  SafeGivePlayerWeapon(id, 41, 999);
						  SafeGivePlayerWeapon(id, 16, 5);
						  SafeGivePlayerWeapon(id, 27, 100);
							SetPlayerSkin(id, 285);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has put on a tactical uniform and geared up with heavy equipment.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 8)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
						  SafeResetPlayerWeapons(id);
						  SafeGivePlayerWeapon(id, 3, 1);
						  SafeGivePlayerWeapon(id, 23, 400);
						  SafeGivePlayerWeapon(id, 34, 50);
						  SafeGivePlayerWeapon(id, 46, 1);
							SetPlayerSkin(id, 285);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has put on a tactical uniform and geared up with sharpshooter equipment.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
					}
				}
				else if (item == 9)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] ==2||PlayerInfo[playerid][pMember] ==1||PlayerInfo[playerid][pLeader] ==1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
							SetPlayerArmour(id, 100);
	  		  	    SetPlayerHealth(id, 100);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s places on a Kevlar vest and eats some donuts.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		  				}
					}
				}
				else if (item == 10)
				{
					if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pLeader] == 1)
					{
						if (PlayerInfo[playerid][pRank] > 2)
						{
							SafeResetPlayerWeapons(id);
							SafeResetPlayerWeapons(id);
						  	SafeGivePlayerWeapon(id, 44, 1);
							GetPlayerName(id, sendername, sizeof(sendername));
							format(string, sizeof(string), "* %s has equipped a pair of nightvision goggles.", sendername);
							ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	 					}
					}
				}
				else if (item == 11)
				{
					if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
					{
					  SafeGivePlayerWeapon(id, 45, 1);
    					format(string, sizeof(string), "* %s has equipped a pair of thermal goggles.", sendername);
						ProxDetector(30.0, id, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else if (item == 12)
				{
				  new originalskin = PlayerInfo[id][pChar];
					SetPlayerSkin(id, originalskin);
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "  You don't have the cash for that!");
					return 1;
				}
			}
			return 1;
		}
	}
Reply
#2

bump
Reply
#3

strrest(cmdtext,idx); Must be assigned to a array...
make it an array and your done
Reply
#4

pawn Код:
new itemtwo;
Change to

pawn Код:
new itemtwo[128];
Reply
#5

Quote:
Originally Posted by MadeMan
pawn Код:
new itemtwo;
Change to

pawn Код:
new itemtwo[128];
Okay i'll try that my man
Reply
#6

Okay i've done that but now i do get this errors:

C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(21795) : warning 219: local variable "itemtwo" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(21827) : warning 219: local variable "itemtwo" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(21827) : error 017: undefined symbol "strrest"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(22023) : warning 219: local variable "itemtwo" shadows a variable at a preceding level
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(22023) : error 017: undefined symbol "strrest"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(21795) : warning 203: symbol is never used: "itemtwo"
C:\Users\Simon\Desktop\GTA\GTARP\gamemodes\gtarp.p wn(12374) : warning 204: symbol is assigned a value that is never used: "itemtwo"
Reply
#7

Put this into your script:

pawn Код:
stock strrest(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[128];
    while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#8

Quote:
Originally Posted by MadeMan
Put this into your script:

pawn Код:
stock strrest(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[128];
    while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
At ?
Reply
#9

bump
Reply
#10

Quote:
Originally Posted by Chivava
Quote:
Originally Posted by MadeMan
Put this into your script:

pawn Код:
stock strrest(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[128];
    while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
At ?
Doesn't matter where you put that, though I always put stock functions at the bottom of my script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)