[ScriptHelp]WeaponCheck - 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: [ScriptHelp]WeaponCheck (
/showthread.php?tid=78499)
[ScriptHelp]WeaponCheck -
Marc_307 - 20.05.2009
Can somebody write a code which is able to check the player if he has got a CAMERA? If he has one, nothing, if he hasn't got one, SendClientMessage. Thanks.
Re: [ScriptHelp]WeaponCheck -
Correlli - 20.05.2009
Quote:
Originally Posted by Marc_307
Can somebody write a code which is able to check the player if he has got a CAMERA? If he has one, nothing, if he hasn't got one, SendClientMessage. Thanks. 
|
Just check players weapon with
GetPlayerWeapon in a timer.
Camera id is 43.
Quote:
Originally Posted by wiki.sa-mp.com
(***) The imagery effects from these weapons (43, 44, 45 ids) will show for all players.
|
Re: [ScriptHelp]WeaponCheck -
Marc_307 - 20.05.2009
I've done something like this, but after each spawn the message is sended.
pawn Код:
//on top of the script
new CameraCheckTimer;
forward CameraCheck(playerid);
//under OnPlayerSpawn
CameraCheckTimer = SetTimerEx("CameraCheck",1000,1,"i",playerid);
//in the script
public CameraCheck(playerid)
{
new ammo,weapon;
GetPlayerWeaponData(playerid,9,weapon,ammo);
if(weapon == 43)
{
if(ammo < 1)
{
SendClientMessage(playerid,RED,"No camera!!!");
KillTimer(CameraCheckTimer);
}
}
}
Re: [ScriptHelp]WeaponCheck -
Correlli - 20.05.2009
Sure it is, the timer is called everytime someone spawns. But if you are doing it at OnPlayerSpawn, you can do it without a timer, too.
Re: [ScriptHelp]WeaponCheck -
Marc_307 - 20.05.2009
yes, but the player should always be checked, nut only when he spawns.
What can I do?
Re: [ScriptHelp]WeaponCheck -
Correlli - 20.05.2009
Quote:
Originally Posted by Marc_307
yes, but the player should always be checked, nut only when he spawns.
|
Then keep it in timer. I though you want to check him only at spawn.