[ScriptHelp]WeaponCheck
#1

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

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

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);
        }
    }
}
Reply
#4

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

yes, but the player should always be checked, nut only when he spawns.
What can I do?
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)