Repairing Vehicle Pickup doenst work - 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: Repairing Vehicle Pickup doenst work (
/showthread.php?tid=628627)
Repairing Vehicle Pickup doenst work -
aw1337 - 12.02.2017
Hello,
ive created the repairpickup (ID 3096) and it is being created normally.
I wanted that if faction id 2 & 3 enter it, theyre vehicle will get repaired.
But if i enter it, the car doesnt get repaired / Clientmessage is not coming up.
Can someone look over please?
Код:
if(pickupid==3096)
{
if(pInfo[playerid][fraktion]==2 && pInfo[playerid][fraktion]==3)
{
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, GELB, "Du hast das Fahrzeug repariert.");
}
}
else
{
SendClientMessage(playerid, GRAU, "Du hast keine Berechtigungen dein Fahrzeug zu reparieren.");
return 1;
}
}
The code is under Callback "OnPlayerPickUpPickup"
Re: Repairing Vehicle Pickup doenst work -
Macronix - 12.02.2017
Where do you create the pickup? Show the code please
You have to do something like "RepairPickup = CreatePickup....." and then check for "RepairPickup" under OnPlayerPickUpPickup.
PHP код:
new RepairPickup;
RepairPickup = CreatePickup(...);
//Under OnPlayerPickUpPickup
if(pickupid == RepairPickup)
{
if(pInfo[playerid][fraktion]==2 && pInfo[playerid][fraktion]==3)
{
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, GELB, "Du hast das Fahrzeug repariert.");
}
}
else
{
SendClientMessage(playerid, GRAU, "Du hast keine Berechtigungen dein Fahrzeug zu reparieren.");
return 1;
}
}