Carspawner don't work
#1

hll everyone, i got this FS from this forum.
But after days and days testing, asking and editing... it still don't work !

pawn Код:
#include <a_samp>

#define MAX_MENUES 5

new Menu:VehicleMenu[MAX_MENUES];
new PlayerVehicle[MAX_PLAYERS];

//Change models and names, if you don't like them.
//All the car id's
new VehicleModels[12][MAX_MENUES]=
{
    {402,558,448,403,520},
    {411,559,461,407,425},
    {415,560,462,427,513},
    {429,561,523,437,519},
    {451,562,521,482,592},
    {477,565,522,588,577},
    {480,534,481,528,593},
    {506,535,463,471,476},
    {541,536,586,571,466},
    {602,567,441,572,430},
    {603,566,464,573,453},
    {502,412,465,532,539}
};

new VehicleNames[12][MAX_MENUES][32]=
{
    {"Buffalo","Uranus","Pizzaboy","Linerunner","Hydra"},
    {"Infernus","Jester","PCJ-600","Firetruck","Hunter"},
    {"Cheetah","Sultan","Faggio","Enforcer","Stuntplane"},
    {"Banshee","Stratum","Copbike","Coach","Shamal"},
    {"Turismo","Elegy","FCR-900","Burrito","Andromada"},
    {"ZR-350","Flash","NRG-500","Hotdog","AT-400"},
    {"Comet","Remington","BMX","FBI-Truck","Dodo"},
    {"Super GT","Slamvan","Freeway","Quad","Rustler"},
    {"Bullet","Blade","Wayfarer","Gokart","Squalo"},
    {"Alpha","Savanna","RC-Bandit","Mower","Predator"},
    {"Phoenix","Tahoma","RC-Baron","Dune","Reefer"},
    {"Hotring Racer","Voodoo","RC-Raider","Combine Harvester","Vortex"}
};

public OnFilterScriptInit()
{
    print("+-------------------------------+");
    print("¦  Carspawner loaded...         ¦");
    print("+-------------------------------+");
   
    for(new i=0;i<MAX_MENUES;i++)
    {
        VehicleMenu[i]=CreateMenu("Carmenu",1,270,140,220,1);
        for(new j=0;j<12;j++)
            AddMenuItem(VehicleMenu[i],0,VehicleNames[j][i]);
    }

    return 1;
}

public OnFilterScriptExit()
{
    for(new i=0;i<MAX_MENUES;i++)
        DestroyMenu(VehicleMenu[i]);
       
    for(new i=0;i<MAX_PLAYERS;i++)
        if(IsPlayerConnected(i))
            DestroyPlayerVehicle(i);
   
    print("+-------------------------------+");
    print("¦  CarSpawner unloaded...       ¦");
    print("+-------------------------------+");
    return 1;
}

public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if(newkeys==KEY_LOOK_BEHIND && GetPlayerState(playerid)==PLAYER_STATE_ONFOOT)
    {
        if(PlayerVehicle[playerid]!=0)
        {
            new Float:x,Float:y,Float:z,Float:angle;
            GetPlayerPos(playerid,x,y,z);
            GetPlayerFacingAngle(playerid,angle);
            PutPlayerInVehicle(playerid,PlayerVehicle[playerid],0);
            SetVehiclePos(PlayerVehicle[playerid],x,y,z);
            SetVehicleZAngle(PlayerVehicle[playerid],angle);
            LinkVehicleToInterior(PlayerVehicle[playerid],GetPlayerInterior(playerid));
            return 1;
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
   
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    DestroyPlayerVehicle(playerid);
    return 1;
}

public OnPlayerSelectedMenuRow(playerid,row)
{
    new Menu:Menu=GetPlayerMenu(playerid);
    if(Menu==VehicleMenu[0])
    {
        DestroyPlayerVehicle(playerid);
        CreatePlayerVehicle(playerid,VehicleModels[row][0]);
        PutPlayerInVehicle(playerid,PlayerVehicle[playerid],0);
        TogglePlayerControllable(playerid,true);
        return 1;
    }
    if(Menu==VehicleMenu[1])
    {
        DestroyPlayerVehicle(playerid);
        CreatePlayerVehicle(playerid,VehicleModels[row][1]);
        PutPlayerInVehicle(playerid,PlayerVehicle[playerid],0);
        TogglePlayerControllable(playerid,true);
        return 1;
    }
    if(Menu==VehicleMenu[2])
    {
        DestroyPlayerVehicle(playerid);
        CreatePlayerVehicle(playerid,VehicleModels[row][2]);
        PutPlayerInVehicle(playerid,PlayerVehicle[playerid],0);
        TogglePlayerControllable(playerid,true);
        return 1;
    }
    if(Menu==VehicleMenu[3])
    {
        DestroyPlayerVehicle(playerid);
        CreatePlayerVehicle(playerid,VehicleModels[row][3]);
        PutPlayerInVehicle(playerid,PlayerVehicle[playerid],0);
        TogglePlayerControllable(playerid,true);
        return 1;
    }
    if(Menu==VehicleMenu[4])
    {
        DestroyPlayerVehicle(playerid);
        CreatePlayerVehicle(playerid,VehicleModels[row][4]);
        PutPlayerInVehicle(playerid,PlayerVehicle[playerid],0);
        TogglePlayerControllable(playerid,true);
        return 1;
    }
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/menu1",true))
    {
        TogglePlayerControllable(playerid,false);
        ShowMenuForPlayer(VehicleMenu[0],playerid);
        return 1;
    }
    if(!strcmp(cmdtext,"/menu2",true))
    {
        TogglePlayerControllable(playerid,false);
        ShowMenuForPlayer(VehicleMenu[1],playerid);
        return 1;
    }
    if(!strcmp(cmdtext,"/menu3",true))
    {
        TogglePlayerControllable(playerid,false);
        ShowMenuForPlayer(VehicleMenu[2],playerid);
        return 1;
    }
    if(!strcmp(cmdtext,"/menu4",true))
    {
        TogglePlayerControllable(playerid,false);
        ShowMenuForPlayer(VehicleMenu[3],playerid);
        return 1;
    }
    if(!strcmp(cmdtext,"/menu5",true))
    {
        TogglePlayerControllable(playerid,false);
        ShowMenuForPlayer(VehicleMenu[4],playerid);
        return 1;
    }
    return 0;
}

public OnPlayerExitedMenu(playerid)
{
    TogglePlayerControllable(playerid,true);
    return 1;
}

forward CreatePlayerVehicle(playerid,modelid);
public CreatePlayerVehicle(playerid,modelid)
{
    if(PlayerVehicle[playerid]!=0) return 0;
    new Float:x,Float:y,Float:z,Float:angle;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,angle);
    PlayerVehicle[playerid]=CreateVehicle(modelid,x,y,z,angle,-1,-1,60000);
    LinkVehicleToInterior(PlayerVehicle[playerid],GetPlayerInterior(playerid));
    return PlayerVehicle[playerid];
}

forward DestroyPlayerVehicle(playerid);
public DestroyPlayerVehicle(playerid)
{
    if(!PlayerVehicle[playerid]) return 0;
    DestroyVehicle(PlayerVehicle[playerid]);
    PlayerVehicle[playerid]=0;
    return 1;
}
If you can help ... help me then ! xp It's important to me ^^

THE PROBLEM IS THAT THE CARS DON'T SPAWN
Reply
#2

If you could tell use what happens and what is wrong that would be great.
Reply
#3

Quote:
Originally Posted by iggy1
Посмотреть сообщение
If you could tell use what happens and what is wrong that would be great.
Ehm..
Quote:
THE PROBLEM IS THAT THE CARS DON'T SPAWN
Reply
#4

Quote:
Originally Posted by iggy1
Посмотреть сообщение
If you could tell use what happens and what is wrong that would be great.
|
|
| TIP: see the last line in the topic or see the next reply x)
|
|
|
v
Quote:
Originally Posted by Not available
Посмотреть сообщение
Ehm..
Lol (y) ^^
Reply
#5

My bad i didn't read that because it looks like its in your sig (on first glance) i can't see the sig line on my screen because of the size its attached to one of the black images in your sig.

EDIT: Have you tried adding some print() lines or even SendClientMessage lines to see what get executed and what dosn't?
Reply
#6

Quote:
Originally Posted by iggy1
Посмотреть сообщение
My bad i didn't read that because it looks like its in your sig (on first glance) i can't see the sig line on my screen because of the size its attached to one of the black images in your sig.

EDIT: Have you tried adding some print() lines or even SendClientMessage lines to see what get executed and what dosn't?
hh i make the "The problem is ..." bigger and with a color because if someone don't see it ... and you thought it was in the sig x)

Ok ... I have print() lines in the FS but the FS don't use any SendClientmessage lines :-/
Reply
#7

*ANYONE? (bump)*
Reply
#8

pawn Код:
forward CreatePlayerVehicle(playerid,modelid);
public CreatePlayerVehicle(playerid,modelid)
{
    if(PlayerVehicle[playerid]!=0) return 0;
    new Float:x, Float:y, Float:z, Float:angle;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, angle);
    new vehicleid = CreateVehicle(modelid, x, y, z, angle, -1, -1, -1);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
    PlayerVehicle[playerid] = 1;
    return 1;
}
Reply
#9

Quote:
Originally Posted by Clive
Посмотреть сообщение
pawn Код:
forward CreatePlayerVehicle(playerid,modelid);
public CreatePlayerVehicle(playerid,modelid)
{
    if(PlayerVehicle[playerid]!=0) return 0;
    new Float:x, Float:y, Float:z, Float:angle;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, angle);
    new vehicleid = CreateVehicle(modelid, x, y, z, angle, -1, -1, -1);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
    PlayerVehicle[playerid] = 1;
    return 1;
}
Thanks but don't work ... :-/ <_<
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)