14.05.2012, 00:52
You should read the SA-MP API documentation on these functions, as you're not using some of them correctly, for example GetPlayerHealth and GetPlayerArmour. They do not return the values, you need to pass a variable as the second argument to store the value in, for example:
Also, as the above poster said, OnPlayerUpdate is a horrible choice to use for this snippet of code as it gets called every time a player sends a packet to the server, which can be many many times a second. Use a timer and a callback, for example:
pawn Код:
new Float: health; // Initialize a float to store the health
GetPlayerHealth(playerid, health); // Store the value in the float we initialized earlier
pawn Код:
SetTimer("RefreshData", 1000, true); // Set a repeating timer every 1,000 miliseconds to call the RefreshData function
forward RefreshData();
public RefreshData()
{
// Do what you need to do every second here.
return 1;
}