30.06.2013, 17:37
Hello, I have a custom admin system, i created this command /aveh to spawn admin vehicles by name but it not working every time i'm getting message "USAGE: /aveh [vehicle name]" and cars are not spawning.
please tell what is wrong here.
here is code:
please tell what is wrong here.
here is code:
pawn Code:
dcmd_aveh(playerid, params[])
{
new Vehicle[50], Float:pos[4];
if(pInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
if(sscanf(params, "s[50]", Vehicle)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /aveh [vehicle name]");
else
{
new string[128];
new veh = GetVehicleModelIDFromName(Vehicle);
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
format(string, sizeof(string), "* You have spawned a %s. ID: %i. ", VehicleNames[veh - 400], veh);
SendClientMessage(playerid, COLOR_SKYBLUE, string);
for(new i=0; i<MAX_CUSTOM_VEHICLES; i++)
{
if(!cVeh[i])
{
cVeh[i] = CreateVehicle(veh, pos[0], pos[1], pos[2], pos[3], 0, 0, 1200);
PutPlayerInVehicle(playerid,cVeh[i],0);
i = MAX_CUSTOM_VEHICLES;
LinkVehicleToInterior(cVeh[i], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(cVeh[i], GetPlayerVirtualWorld(playerid));
}
}
if(veh < 400 || veh > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid Vehicle ID / Name.");
}
return 1;
}