10.09.2010, 16:48
Here's my stock. I wrote it myself because I couldn't find anything better.
Here's my command:
PROBLEM: When in-game, the name doesn't show up in the cyan message(the vehstring). It's just 2 brackets.
Obviously, my stock doesn't return that string properly, so what did I do wrong.
Код:
stock GetVehicleName(vehid) { new namestring[24]; if(vehid == 400) format(namestring,sizeof(namestring),"Landstalker"); if(vehid == 401) format(namestring,sizeof(namestring),"Bravura"); if(vehid == 402) format(namestring,sizeof(namestring),"Buffalo"); ..... etc if(vehid == 610) format(namestring,sizeof(namestring),"Farm Trailer"); if(vehid == 611) format(namestring,sizeof(namestring),"Utility Trailer"); return namestring; }
Код:
dcmd_veh(playerid, params[]) { new vehmod; new color1; new color2; if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(AdminCar[playerid]) { new estring[128]; new evehname[24]; format(evehname,sizeof(evehname),"%s",GetVehicleName(AdminCar[playerid])); format(estring,sizeof(estring), "ERROR: You already spawned an Admin Vehicle(%s). Use /gotov (%d) to find it.",evehname,AdminCar[playerid]); SendClientMessage(playerid, COLOR_GREY, estring); return 1; } if(sscanf(params,"ddd",vehmod,color1,color2)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /veh (Vehicle Model ID) (Color ID 1) (Color ID 2)"); if(vehmod < 400 || vehmod > 611) return SendClientMessage(playerid, COLOR_GREY, "Invalid Vehicle Model ID. [400-611]"); new Float:ax, Float:ay, Float:az, Float:angle; GetPosInFrontOfPlayer(playerid, ax, ay, 10.0); new Float:lolx, Float:loly; GetPlayerPos( playerid, lolx, loly, az ); GetPlayerFacingAngle(playerid, angle); AdminCar[playerid] = CreateVehicle(vehmod, ax, ay, az+0.60, angle, color1, color2, -1); new vehstring[128]; new vehname[24]; format(vehname,sizeof(vehname),"%s",GetVehicleName(AdminCar[playerid])); format(vehstring,sizeof(vehstring),"** You spawned a vehicle: %s(Model %d) - Color 1: %d - Color 2: %d - Remember to delete it!", vehname, vehmod, color1, color2); SendClientMessage(playerid, COLOR_CYAN, vehstring); new astring[128]; format(astring,sizeof(astring),"has spawned: %s (Model %d, ID %d).",vehname,vehmod,AdminCar[playerid]); return 1; }
Obviously, my stock doesn't return that string properly, so what did I do wrong.