SA-MP Forums Archive
Save keys in one variable (/givekey) - 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: Save keys in one variable (/givekey) (/showthread.php?tid=95584)



Save keys in one variable (/givekey) - godknightx - 04.09.2009

Hy all

I have a problem, and i dont know how can i edit the command...
So, my /givekey command save only 1 key, but i want save more than 1 key.
E.g if X men give his key to me, i can lock his car, but if Y man give key to me, i cant unlock the X men's car...
So any idea ?

The command:
Код:
	if(strcmp(cmd, "/givekey", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			new car;
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givekey [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(HireCar[playerid] == 299 && PlayerInfo[playerid][pPhousekey] == 255)
			{
				SendClientMessage(playerid, COLOR_GRAD1, " You dont have a key to give");
				return 1;
			}
			else
			{
				if(HireCar[playerid] != 299 && SwitchKey[playerid] == 0)
				{
					car = HireCar[playerid];
					gCarLock[car] = 0;
					UnLockCar(car);
					HireCar[playerid] = 299;
				}
				else
				{
					car = PlayerInfo[playerid][pPhousekey]+1;
				}
			}
			if (IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
					if(ProxDetectorS(5.0, playerid, giveplayerid))
					{
						if(HireCar[giveplayerid] != 299)
						{
							gCarLock[HireCar[giveplayerid]] = 0;
							UnLockCar(HireCar[giveplayerid]);
						}
						HireCar[giveplayerid] = car;
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "  You have given %s the key to your vehicle", giveplayer);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						format(string, sizeof(string), "  You have recieved the key to a vehicle from %s", sendername);
						SendClientMessage(giveplayerid, COLOR_GRAD1, string);
						format(string, sizeof(string), "* %s takes out a set of keys, and tosses them to %s.", sendername ,giveplayer);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
			}
		}
		return 1;
	}
Thanx,
and sorry, iam hungarian...


Re: Save keys in one variable (/givekey) - MenaceX^ - 04.09.2009

GF Topic.


Re: Save keys in one variable (/givekey) - godknightx - 04.09.2009

Lol... you cant help me ?
Thanx... really...


Re: Save keys in one variable (/givekey) - MenaceX^ - 04.09.2009

I can, but with this attitude I can't. If you had bothered reading the forums rules you wouldn't have posted this topic.