Save keys in one variable (/givekey)
#1

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...
Reply
#2

GF Topic.
Reply
#3

Lol... you cant help me ?
Thanx... really...
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)