06.04.2011, 19:16
How i can make it to be not with id to be with the names of the cars
Код:
#include <a_samp> #include <strtok> new Vehicle[MAX_PLAYERS]; new HaveVehicle[MAX_PLAYERS]; public OnPlayerCommandText( playerid, cmdtext[]) { new cmd[256]; new tmp[256], idx; cmd = strtok(cmdtext,idx); if(strcmp(cmd,"/spawn",true) == 0) { if(HaveVehicle[playerid] == 1) return SendClientMessage(playerid,0xE60005FF,"{FFFFFF}You already have{1B1BE0} vehicle! {FFFFFF}Please {1B1BE0}exit{FFFFFF} your vehicle."); { tmp = strtok(cmdtext,idx); //What goes after /freeze if(!strlen(tmp)) return SendClientMessage(playerid,0xE60005FF,"{FFFFFF}Usage: {1B1BE0}/spawn [Vehicle ID]{FFFFFF}."); SpawnVehicle(playerid, (strval(tmp))); HaveVehicle[playerid] = 1; } return 1; } return 0; } forward SpawnVehicle(playerid, vehicleid); public SpawnVehicle(playerid, vehicleid) { new Float:X, Float:Y, Float:Z; new Text3D:vehicle3Dtext; new i; GetPlayerPos(playerid, X, Y, Z); Vehicle[playerid] = CreateVehicle(vehicleid, X, Y, Z, 0, 1, 169, -1); PutPlayerInVehicle(playerid, Vehicle[playerid], 0); for(i=0;i<MAX_PLAYERS;i++) { if(i != playerid) { SetVehicleParamsForPlayer(Vehicle[playerid],i, 0, 1); } } vehicle3Dtext = Create3DTextLabel( "{FFFFFF}Private Vehicle! {1B1BE0}/spawn",0xE60005FF, 0.0, 0.0, 0.0, 50.0, 0, 1 ); Attach3DTextLabelToVehicle( vehicle3Dtext, Vehicle[playerid], 0.0, 0.0, 2.0); return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { DestroyVehicle(Vehicle[playerid]); HaveVehicle[playerid] = 0; return 1; }