Onvehicledeath. Script help!
#1

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
Reply
#2

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]; 
Reply
#3

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

can someone help me?
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)