SA-MP Forums Archive
Police with pistol - 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: Police with pistol (/showthread.php?tid=308141)



Police with pistol - falling - 02.01.2012

How can i make it so that when u spawn as a police not a trucker, u receive a pistol?


Re: Police with pistol - Basssiiie - 02.01.2012

Code:
public OnPlayerSpawn(playerid)
{
	new pSkin = GetPlayerSkin(playerid);
	switch (pSkin)
	{
		case 280..284: // Cop skins
		{
			GivePlayerWeapon(playerid, 22, 500);
		}
	}
	return 1;
}
That's one of the many ways to do this.


Re: Police with pistol - falling - 02.01.2012

C:\Users\me\Desktop\PPC_Trucking6[1]\PPC_Trucking6\gamemodes\PPC_Trucking.pwn(63 : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

Code:
		case ClassPolice: // Police class
		{
			format(missiontext, sizeof(missiontext), Police_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassPolice); // Set the playercolor (chatcolor for the player and color on the map)
			// Start the PlayerCheckTimer to scan for wanted players (be sure the timer has been destroyed first)
			KillTimer(APlayerData[playerid][PlayerCheckTimer]);
			APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Police_CheckWantedPlayers", 1000, true, "i", playerid);
			// Check if the police player can get weapons
			if (PoliceGetsWeapons == true)
			{
			    // Give up to 12 weapons to the player
				for (new i; i < 12; i++)
				    GivePlayerWeapon(playerid, APoliceWeapons[i], PoliceWeaponsAmmo);
	CASE 638			    GivePlayerWeapon(playerid, 22, 500);
			}
		}



Re: Police with pistol - Basssiiie - 02.01.2012

Change it to this:
Code:
for (new i; i < 12; i++)
	{GivePlayerWeapon(playerid, APoliceWeapons[i], PoliceWeaponsAmmo);}
GivePlayerWeapon(playerid, 22, 500);



Re: Police with pistol - falling - 02.01.2012

it didnt give any errors but when i chose class police and spawned, didnt have pistol?


Re: Police with pistol - falling - 02.01.2012

any ideas?


Re: Police with pistol - Basssiiie - 02.01.2012

Code:
case ClassPolice: // Police class
What is ClassPolice? What number? Can you show it to us? And the 'switch' code would be helpful too.


Re: Police with pistol - falling - 02.01.2012

what do you mean, what nubmer?


Re: Police with pistol - Basssiiie - 02.01.2012

I guess ClassPolice is a define, if it's a define, please show us that define. And the 'switch' function before your case function might be useful too. Just give us more information about your script. We don't know what the other conditions are, so we can't fix your problem until we have more of your script.


Re: Police with pistol - falling - 02.01.2012

im new with this .pwn scripts and i started of so i don't know where does that class locate? do u? somewhere in gamemodes?