Vip Spawn Car will no delete!
#1

Helloo every one reading this post !

I hhave a masive problem with my vip system script, its about spawning a car

Every think works okey but then someone destroys me while im in a car and then i have been spawned in a random place and the car is destroyd it is being spawned in the same place where i have uses the command !

The script works when i type /tank im in the tank and every thinks okey i i get carjacked and i type the /tank kicks the carjacker from the car and im in it again but the destroy part doese not work because its alweys spawned in the place i use the command.

There is the script !

Код:
YCMD:tank(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][VIP] < 2) return SCM(playerid, COLOR_RED, "Musisz byc Silver VIP graczem aby uzywac tej komendy!");
{
if(myCar[playerid] != 0) DestroyVehicle(myCar[playerid]);
if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're in a vehicle.");
			else
			{
   			new Float:pX,Float:pY,Float:pZ,Float:pw;
      		GetPlayerPos(playerid, pX,pY,pZ);
      		GetPlayerFacingAngle(playerid, pw);
   			myCar[playerid] = CreateVehicle(432, pX, pY, pZ, pw, 0, 0, 0);
            PutPlayerInVehicle(playerid, myCar[playerid], 0);
            GameTextForPlayer(playerid,"~w~Bullet",3000,1);
			}
}
}
Reply
#2

Hello, try this :
Код:
YCMD:tank(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][VIP] < 2) return SCM(playerid, COLOR_RED, "Musisz byc Silver VIP graczem aby uzywac tej komendy!");
{
if(myCar[playerid] != 0) DestroyVehicle(myCar[playerid]);
if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're in a vehicle.");
			else
			{
   			new Float:pX,Float:pY,Float:pZ,Float:pw;
      		GetPlayerPos(playerid, pX,pY,pZ);
      		GetPlayerFacingAngle(playerid, pw);
   			myCar[playerid] = CreateVehicleEx(432, pX, pY, pZ, pw, 0, 0, 0);
            PutPlayerInVehicle(playerid, myCar[playerid], 0);
            GameTextForPlayer(playerid,"~w~Bullet",3000,1);
			}
}
}
Reply
#3

pawn Код:
YCMD:tank(playerid, params[], help)
{
    #pragma unused help
    if(P_Data[playerid][VIP] < 2) return SCM(playerid, COLOR_RED, "Musisz byc Silver VIP graczem aby uzywac tej komendy!");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FF00AA, "You're in a vehicle.");
    if(IsValidVehicle(myCar[playerid])) DestroyVehicle(myCar[playerid]);
    new Float:pX, Float:pY, Float:pZ, Float:pw;
    GetPlayerPos(playerid, pX, pY, pZ);
    GetPlayerFacingAngle(playerid, pw);
    myCar[playerid] = CreateVehicleEx(432, pX, pY, pZ, pw, 0, 0, 0);
    PutPlayerInVehicle(playerid, myCar[playerid], 0);
    GameTextForPlayer(playerid,"~w~Bullet", 3000, 1);
}
pawn Код:
//Just under #include <a_samp>
native IsValidVehicle(vehicleid);
Reply
#4

The car will respawn as long as you don't destroy it. You should delete the vehicle when the player leaves the car (OnPlayerStateChange) with a timer or something.
Reply
#5

@ BenzoAMG

Okey did what you told me but 1 error ;(
Код:
C:\Users\TreNT\Desktop\Admin_System.pwn(1224) : error 017: undefined symbol "CreateVehicleEx"
@ Golimad

The same error ;(
Reply
#6

Oh wtf, change it to CreateVehicle -_-
Not sure why Golimad had that in there.

@CuerVo, I'm not sure if that's what he really wants to be honest. If I was going to spawn a tank, it would really annoy me if it was to keep destroying every time I left it. He can alter the code however he wants nonetheless.
Reply
#7

@ BenzoAMG

Well there is no errors this time but doesent work it still after me destroing that tank its spawning where i have typed the command ;( what does CuerVo mean ? If you leave the tank it destroys it self ? i would do that but i cant no skill ;(
Reply
#8

Oh, you want it like that? 0_o

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
    {
        if(IsValidVehicle(myCar[playerid])) DestroyVehicle(myCar[playerid]);
    }
    return 1;
}
Reply
#9

BenzoAMG@

Works fine i want that to work like this so the car doeas not spawn on players death in the place where he typed the command but there is another problem because if another silver player types /tank it kick another the one in the tank ;( so only one player can have a tank and i dont want that way ;(
Reply
#10

Yeah, this is a weird samp bug I'm pretty sure. I still don't know what causes this, but it is very common in a lot of servers.

EDIT: Actually...

pawn Код:
YCMD:tank(playerid, params[], help)
{
    #pragma unused help
    if(P_Data[playerid][VIP] < 2) return SCM(playerid, COLOR_RED, "Musisz byc Silver VIP graczem aby uzywac tej komendy!");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FF00AA, "You're in a vehicle.");
    if(IsValidVehicle(myCar[playerid])) DestroyVehicle(myCar[playerid]);
    new Float:pX, Float:pY, Float:pZ, Float:pw;
    GetPlayerPos(playerid, pX, pY, pZ);
    GetPlayerFacingAngle(playerid, pw);
    myCar[playerid] = CreateVehicleEx(432, pX, pY, pZ, pw, 0, 0, 0);
    PutPlayerInVehicle(playerid, myCar[playerid], 0);
    GameTextForPlayer(playerid,"~w~Bullet", 3000, 1);
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
    {
        if(IsValidVehicle(myCar[playerid])) DestroyVehicle(myCar[playerid]);
        myCar[playerid] = INVALID_VEHICLE_ID;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)