SA-MP Forums Archive
Spawned Vehicles - Respawn? - 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: Spawned Vehicles - Respawn? (/showthread.php?tid=232319)



Spawned Vehicles - Respawn? - Rolyy - 27.02.2011

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;
    }



Re: Spawned Vehicles - Respawn? - Davz*|*Criss - 27.02.2011

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;
    }



Re: Spawned Vehicles - Respawn? - Rolyy - 27.02.2011

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


Re: Spawned Vehicles - Respawn? - Davz*|*Criss - 27.02.2011

/Requestremove?


Re: Spawned Vehicles - Respawn? - Rolyy - 27.02.2011

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


AW: Spawned Vehicles - Respawn? - Nero_3D - 27.02.2011

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);
    }



Re: AW: Spawned Vehicles - Respawn? - Rolyy - 27.02.2011

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) {



AW: Re: AW: Spawned Vehicles - Respawn? - Nero_3D - 27.02.2011

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


Re: Spawned Vehicles - Respawn? - Rolyy - 27.02.2011

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


Re: Spawned Vehicles - Respawn? - Mean - 27.02.2011

Put it at first line then.