SA-MP Forums Archive
Onvehicledeath. Script help! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Onvehicledeath. Script help! (/showthread.php?tid=267012)



Onvehicledeath. Script help! - ppeterpp - 06.07.2011

PHP код:
public OnVehicleDeath(vehicleidkillerid) {
    foreach(
Playerv) {
        if(
playerVariables[v][pCarID] == vehicleid) {
            
DestroyVehicle(vehicleid); // If an owned car is destroyed... it'll be manually despawned...
            
systemVariables[vehicleCounts][1]--;
            
playerVariables[v][pCarPos][0] = [pCarSavePos]; // Respawned where it's saved
            
playerVariables[v][pCarPos][1] = [pCarSavePos];
            
playerVariables[v][pCarPos][2] = [pCarSavePos];
            
playerVariables[v][pCarPos][3] = [pCarSavePos]; // have its Z angle set
            
SpawnPlayerVehicle(v); // And spawned.
            
SetVehicleHealth(playerVariables[v][pCarID], 400.0); // A wrecked car is a wrecked car.
            
new
                
Damage[4]; // Complete the job!
            
GetVehicleDamageStatus(playerVariables[v][pCarID], Damage[0], Damage[1], Damage[2], Damage[3]);
            
Damage[0] = encode_panels(1111333);
            
Damage[1] = encode_doors(4444);
            
Damage[2] = encode_lights(1111);
            
UpdateVehicleDamageStatus(playerVariables[v][pCarID], Damage[0], Damage[1], Damage[2], Damage[3]);
        }
    }
    return 
1
The error is

d:\Fontos\Version 0.0.1alpha\gamemodes\rp.pwn(987) : error 029: invalid expression, assumed zero
d:\Fontos\Version 0.0.1alpha\gamemodes\rp.pwn(987) : warning 215: expression has no effect
d:\Fontos\Version 0.0.1alpha\gamemodes\rp.pwn(987) : error 001: expected token: ";", but found "]"
d:\Fontos\Version 0.0.1alpha\gamemodes\rp.pwn(987) : error 029: invalid expression, assumed zero
d:\Fontos\Version 0.0.1alpha\gamemodes\rp.pwn(987) : fatal error 107: too many error messages on one

with coordinates

playerVariables[v][pCarPos][0] = 508.5559; like this it works!

Thank you for helping!

Regards


Re: Onvehicledeath. Script help! - Shadoww5 - 06.07.2011

This can be caused because [pCarPos] is a Float and you didn't define it.

Example:

PHP код:
enum xx 

    
Float:pCarPos 
}
new 
playerVariables[MAX_VEHICLES][xx]; 



Re: Onvehicledeath. Script help! - ppeterpp - 07.07.2011

Float: pCarPos[4],
Float: pCarSavePos[4],


Re: Onvehicledeath. Script help! - ppeterpp - 07.07.2011

can someone help me?


Re: Onvehicledeath. Script help! - Shadoww5 - 07.07.2011

It's correct ... Put like you said:

PHP код:
FloatpCarPos[4],
FloatpCarSavePos[4],