Spawned Vehicles - Respawn?
#1

Wondering if someone could fix this sort of bug, Explaination of bug:
If player uses command "/cheetah", Vehicle respawns on his position and facing the right angle.
If player enters the vehicle, starts driving and suddenly crashes the vehicle, engine on fire and explodes...
The vehicle will dissapear and actually RESPAWN at the place where the player used the command "/Cheetah"..

What I want to get fixed is that when the vehicle crashes, engine on fire and explodes. The vehicle just dissapears.

PLEASE READ CAREFULLY BEFORE POSTING!

PAWN codes of the current command.
pawn Код:
if (strcmp("/cheetah", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid)) {
            SendClientMessage(playerid,COLOR_RED,"You are already in a vehicle!");
            return 1;
        }
        if(!IsPlayerInAnyVehicle(playerid)) {
            new vehicleid;
            new Float:X,Float:Y,Float:Z,Float:Angle;
            GetPlayerPos(playerid,X,Y,Z);
            GetPlayerFacingAngle(playerid,Angle);
            GetPlayerVehicleID(playerid);
            vehicleid = vehicleid = CreateVehicle(415,X,Y,Z,Angle,-1,-1,600);
            PutPlayerInVehicle(playerid, vehicleid, 0);
        }
        return 1;
    }
Reply
#2

This is the command to reset the spawned vehicles:

pawn Код:
if (strcmp("/Resetvehicles", cmdtext, true, 10) == 0)
    {
       for(new i = 0; i < MAX_VEHICLES; i++)
       {
            SetVehicleToRespawn(i);
       }
       return 1;
    }
Reply
#3

I SAID:
Quote:
Originally Posted by Rolyy
Посмотреть сообщение
PLEASE READ CAREFULLY BEFORE POSTING!
/requestremovepost #2 #3 #4 #5
Reply
#4

/Requestremove?
Reply
#5

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
/Requestremove?
STOP SPAMMING THIS THEARD PLEASE!
Reply
#6

This should help you

pawn Код:
//global variable
new bool: gVDestroy[MAX_VEHICLES];
pawn Код:
//OnPlayerCommandText
    if (strcmp("/cheetah", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid)) {
            SendClientMessage(playerid,COLOR_RED,"You are already in a vehicle!");
            return 1;
        }
        new
            Float: X,
            Float: Y,
            Float: Z,
            Float: Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);
        new vehicleid = CreateVehicle(415,X,Y,Z,Angle,-1,-1,600);
        PutPlayerInVehicle(playerid, vehicleid, 0);
        gVDestroy[vehicleid - 1] = true;
        return 1;
    }
pawn Код:
//OnVehicleSpawn
    if(gVDestroy[vehicleid - 1] == true) {
        gVDestroy[vehicleid - 1] = false;
        DestroyVehicle(vehicleid);
    }
Reply
#7

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
This should help you

pawn Код:
new gVDestroy[MAX_VEHICLES];
pawn Код:
if (strcmp("/cheetah", cmdtext, true, 10) == 0)
{
    if(IsPlayerInAnyVehicle(playerid)) {
        SendClientMessage(playerid,COLOR_RED,"You are already in a vehicle!");
        return 1;
    }
    new
        Float: X,
        Float: Y,
        Float: Z,
        Float: Angle;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    new vehicleid = CreateVehicle(415,X,Y,Z,Angle,-1,-1,600);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    gVDestory[vehicleid - 1] = true;
    return 1;
}
pawn Код:
//OnVehicleSpawn
    if(gVDestroy[vehicleid - 1] == true) {
        gVDestroy[vehicleid - 1] = false;
        DestroyVehicle(vehicleid);
    }
Tryed all that but these error's came out.

Код:
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : error 017: undefined symbol "gVDestroy"
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : warning 215: expression has no effect
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : error 029: invalid expression, assumed zero
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
329.    if(gVDestroy[vehicleid - 1] == true) {
Reply
#8

Quote:
Originally Posted by Rolyy
Посмотреть сообщение
Tryed all that but these error's came out.

Код:
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : error 017: undefined symbol "gVDestroy"
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : warning 215: expression has no effect
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : error 029: invalid expression, assumed zero
C:\Documents and Settings\...\Desktop\Server_Script\gamemodes\NFS-MW.pwn(329) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
329.    if(gVDestroy[vehicleid - 1] == true) {
You mostly didnt put
pawn Код:
new bool: gVDestroy[MAX_VEHICLES];
high enough, just put it somewhere under #include
Reply
#9

Trust me I did put it there.
But still those errors.
Reply
#10

Put it at first line then.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)