27.01.2015, 16:51
I have made/copied partly a car command and I want to add a message saying, "You spawned a/an [VEHICLENAME]"
How would I do that?
I tried something.
This is my code:
But this doesn't work and just says: "You have spawned a [What you typed after /car]"
so if you typed the ID 1 it just says "You have spawned a 1".
I want it to say the vehicle name from that id.
Do any of you know how to do this?
How would I do that?
I tried something.
This is my code:
Код:
CMD:car(playerid, params[])
{
new carName[100];
new message[128];
if(sscanf(params, "s[100]", carName)) return SendClientMessage(playerid, COL_RED, "[USAGE]: /car [vehiclename].");
if (ReturnVehicleID(carName) == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COL_RED, "[SERVER]: Vehicle name/id not found.");
if (PlayerInfo[playerid][pRights] < 3) return SendClientMessage(playerid, COL_RED, "[SERVER]: You don't have the rights to use this command.");
new Float:pPos[4], vid;
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
vid = CreateVehicle(ReturnVehicleID(carName), pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, vid, 0);
format (message, 128, "You have spawned a %s.", GetVehicleNames(carName));
SendClientMessage(playerid, COL_GREEN, message);
return 1;
}
so if you typed the ID 1 it just says "You have spawned a 1".
I want it to say the vehicle name from that id.
Do any of you know how to do this?


