26.01.2011, 10:55
(
Последний раз редактировалось Michael@Belgium; 26.01.2011 в 11:02.
Причина: The problem forgottn
)
hll everyone, i got this FS from this forum.
But after days and days testing, asking and editing... it still don't work !
If you can help ... help me then ! xp It's important to me ^^
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;
}
THE PROBLEM IS THAT THE CARS DON'T SPAWN