How to detect a function
#1

Hey,
How can i detect a player if he used any function, i mean if the function 'bla bla' is being used.
Example: how to detect if RepairVehicle(vehicleid) is used? i mean with if statements....

+REP
Reply
#2

I don't get your problem... RepairVehicle is a script function, so a player can only use it trough the script. So why don't you look for the function in your code and implement your if-statement at those instances?

Edit: Ah ok, maybe you mean, how to conveniently do this, without finding every use of that function in the script?
Then just use this method: https://sampforum.blast.hk/showthread.php?tid=187195
Reply
#3

You can probably make a player variable. Just do this:

pawn Код:
new repairedVehicle[MAX_PLAYERS]; // global (put this after the includes or defines w/e)

// OnPlayerConnect
repairedVehicle[playerid] = 0; // resetting the variable so that it may not set the previous playerid value

// Whenever you repair a vehicle, just simply set this variable to 1
RepairVehicle(vehicleid); // vehicle is repaired
repairedVehicle[playerid] = 1; // so we will set this to true/1 that the player have updated his vehicle

// Now if you wanted to check if the player vehicle is repaired
if(repairedVehicle[playerid] != 0)
{
    printf("playerid %i has already repaired his vehicle", playerid);
}
else
{
    printf("playerid %i did not repaired his vehicle yet", playerid);
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)