CMD:givecar(playerid,params[])
{
new carid;
new id;
new string[128];
new Float:X, Float:Y, Float:Z, Float:angle;
new car = CreateVehicle(carid, X, Y, Z, angle, 0, 1, 60);
if(sscanf(params,"ir",carid, id)) return SendClientMessage(playerid,-1,"Error: - /givecar [id]"); // checking does sscanf found integer parameter
GetPlayerPos(id, X, Y, Z);
GetPlayerFacingAngle(id, angle);
PutPlayerInVehicle(id, carid, 0);
format(string, sizeof(string), "the admin has chose %s as the event car", GetPlayerVehicleID(playerid));
SendClientMessageToAll(playerid, -1, string);
return 1;
}
CMD:givecar(playerid,params[])
{
new carid;
new id;
new string[128];
new Float:X, Float:Y, Float:Z, Float:angle;
if(sscanf(params,"ir",carid, id)) return SendClientMessage(playerid,-1,"Error: - /givecar [car id] [player id]"); // checking does sscanf found integer parameter
GetPlayerPos(id, X, Y, Z);
GetPlayerFacingAngle(id, angle);
CreateVehicle(carid, X, Y, Z, angle, 0, 1, 60);
PutPlayerInVehicle(id, carid, 0);
format(string, sizeof(string), "the admin has chose %s as the event car", GetPlayerVehicleID(playerid));
SendClientMessageToAll(string);
return 1;
}
CMD:givecar(playerid,params[])
{
new carid;
new id;
new string[128];
new Float:X, Float:Y, Float:Z, Float:angle;
if(sscanf(params,"ir",carid, id)) return SendClientMessage(playerid,-1,"Error: - /givecar [car id] [player id]"); // checking does sscanf found integer parameter
GetPlayerPos(id, X, Y, Z);
GetPlayerFacingAngle(id, angle);
CreateVehicle(carid, X, Y, Z, angle, 0, 1, 60);
PutPlayerInVehicle(id, carid, 0);
format(string, sizeof(string), "the admin has chose %s as the event car", GetPlayerVehicleID(playerid));
SendClientMessageToAll(0xFFCC00FF, string);
return 1;
}
Okay the code tells me your giving them a Car ID that is already spawned, so why are you going through the hassle of creating another car?.
|