SA-MP Forums Archive
Need Small help Rep + - 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: Need Small help Rep + (/showthread.php?tid=567435)



Need Small help Rep + - MBilal - 13.03.2015

Problem when Some budy spawn his car , other player vehicle got removed.

here is code
Код:
			if(pInfo[playerid][pVeh][0] ==1)
			{
            if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're in a vehicle.");
			else
			{
	  		if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
   			new Float:pX,Float:pY,Float:pZ,Float:pw;
      		GetPlayerPos(playerid, pX,pY,pZ);
      		GetPlayerFacingAngle(playerid, pw);
   			SpawnedVehicles[playerid] = CreateVehicle(602, pX, pY, pZ, pw, 0, 0, 0);
            PutPlayerInVehicle(playerid, SpawnedVehicles[playerid], 0);
            GameTextForPlayer(playerid,"~w~Alpha",3000,1);
            format(Jstring,sizeof(Jstring),"%s Spawned his Alpha.", GetName(playerid));
			SCMToAll(yellow, Jstring);
			}
			}else return SendClientMessage(playerid,0x00FF00AA,"You didnt have Alpha.");
			}
			    case 1:
			{
			if(pInfo[playerid][pVeh][1] ==1)
			{
   			if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're in a vehicle.");
			else
			{
			if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
			new Float:pX,Float:pY,Float:pZ,Float:pw;
   			GetPlayerPos(playerid, pX,pY,pZ);
   			GetPlayerFacingAngle(playerid, pw);
   			SpawnedVehicles[playerid] = CreateVehicle(429, pX, pY, pZ, pw, 0, 0, 0);
            PutPlayerInVehicle(playerid, SpawnedVehicles[playerid], 0);
            GameTextForPlayer(playerid,"~w~Banshee",3000,1);
            format(Jstring,sizeof(Jstring),"%s Spawned his Banshee.", GetName(playerid));
			SCMToAll(yellow, Jstring);
			}
			}else return SendClientMessage(playerid,0x00FF00AA,"You didnt have Banshee");
			}
			    case 2:
			{
			if(pInfo[playerid][pVeh][2] ==1)
			{
   			if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're in a vehicle.");
			else
			{
			if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
			new Float:pX,Float:pY,Float:pZ,Float:pw;
			GetPlayerPos(playerid, pX,pY,pZ);
   			GetPlayerFacingAngle(playerid, pw);
		 	SpawnedVehicles[playerid] = CreateVehicle(541, pX, pY, pZ, pw, 0, 0, 0);
            PutPlayerInVehicle(playerid, SpawnedVehicles[playerid], 0);
            GameTextForPlayer(playerid,"~w~Bullet",3000,1);
			format(Jstring,sizeof(Jstring),"%s Spawned his Bullet.", GetName(playerid));
			SCMToAll(yellow, Jstring);
			}
			}else return SendClientMessage(playerid,0x00FF00AA,"You didnt have Bullet");
			}



Re: Need Small help Rep + - Smileys - 13.03.2015

I've had this issue many times too, haven't found a solution for it yet, try debugging it by printing the player's name and current vehicle ID to the console, somewhere it messes up and assigns it to another player or something, try finding out what it does.


Re: Need Small help Rep + - MBilal - 13.03.2015

I dont why it assign playerid or some else ...
so the player other spawn vehicle .. his vehicle got destroyed..

How i can stop Players ID for mixing up ?

its making alot Problem!