SA-MP Forums Archive
OnPlayerSwitchWeapon function without OnPlayerUpdate ? - 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: OnPlayerSwitchWeapon function without OnPlayerUpdate ? (/showthread.php?tid=608398)



OnPlayerSwitchWeapon function without OnPlayerUpdate ? - Rubey - 31.05.2016

Hello. I am looking for a function like OnPlayerSwitcWeapon but doesn't use RAM. It exists ?

(Je parle aussi franзais)


Re: OnPlayerSwitchWeapon function without OnPlayerUpdate ? - Kaliber - 31.05.2016

Look for Timers in your script...which are looping through all players..

and there you can place the code from onplayerupdate too..

btw it's not ram, it's cpu that is used by onplayerupdate


Re: OnPlayerSwitchWeapon function without OnPlayerUpdate ? - Dayrion - 31.05.2016

« Would help if you handed out some code to aid in making this command, but you know, Scripting Help isn't really for making you a command...
But if someone was going to be kind, then they'd need some basis to go on, rather than nothing and guess everything. » - Sew_Suni

Oui on a besoin qui tu codes un minimum pour que l'on puisse t'aider.


Re: OnPlayerSwitchWeapon function without OnPlayerUpdate ? - Rubey - 01.06.2016

Non mais je veux dire, le script OnPlayerSwitchWeapon on peut le crйer comme зa :
Quote:

new lastWeapon[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
lastWeapon[playerid] = 0;
return 1;
}

public OnPlayerUpdate(playerid)
{
new w = GetPlayerWeapon(playerid);
if(w != lastWeapon[playerid])
{
OnPlayerChangeWeapon(playerid, w, lastWeapon[playerid]);
}
lastWeapon[playerid] = w;
return 1;
}

OnPlayerChangeWeapon(playerid, newgun, oldgun)
{
return 1;
}

Mais зa use de la RAM et pour un serveur de 200 joueurs c'est pas top... Je voulais savoir si зa existe sans utiliser OnPlayerUpdate.


Re: OnPlayerSwitchWeapon function without OnPlayerUpdate ? - Deroxi - 01.06.2016

D: code looks pretty messy. In my opinion