SA-MP Forums Archive
How can I do? - 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: How can I do? (/showthread.php?tid=83328)



How can I do? - monster010 - 24.06.2009

How can I make these two commands to do just those in the PD / FBI and NG?

Код:
//=================================[ LSPD GATES ]====================================================================
	if(strcmp(cmd, "/lspdop", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{
	MoveObject(lspdgate,1588.84, -1637.89, 7.18,2);
	SendClientMessage(playerid, COLOR_LIGHTRED, "Portile de la garaj s-au deschis");
	}
	return 1;
}
	if(strcmp(cmd, "/lspdcl", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{
	MoveObject(lspdgate,1588.84, -1637.89, 13.18,2);
	SendClientMessage(playerid, COLOR_GREEN, "Portile de la garaj s-au inchis");
	}
	return 1;
}
&&

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_CROUCH )&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
{
SetObjectRot(bariera, 0, 0, 270);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Bariera S-a Deschis");
SetTimer("closelsdgate",2000,0);
}
return 1;
}
forward closelsdgate();
public closelsdgate()
{
SetObjectRot(bariera, 0, 270, 270);
return 1;
}



Thanks


Re: How can I do? - Stah - 24.06.2009

Make Variables:

Put this on top of the script with the other new's
pawn Код:
new IsLspd[MAX_PLAYERS];
Put this anywhere in the script below "IsLspd[MAX_PLAYERS];" , if you already have "public OnPlayerConnect" then just take the code out.
pawn Код:
public OnPlayerConnect(playerid)
{
   IsLspd[playerid] = 0;
}
Put this anywhere in the script below "IsLspd[MAX_PLAYERS];" , if you already have "public OnPlayerSpawn" then just take the code out.
pawn Код:
public OnPlayerSpawn(playerid)
{
   if(GetPlayerSkin(playerid) == LSPD_SKIN || GetPlayerSkin(playerid) == LSPD_SKIN) // change LSPD_SKIN to the skin id's your using.
   {
       IsLspd[playerid] = 1;
   }
}
Use this anywhere you want.
pawn Код:
if(IsLspd[playerid])
{

}