20.09.2013, 07:45
Please Help me in making /spawn Command.
I mean Like that /spawn <carname>
I mean Like that /spawn <carname>
CMD : spawncar(playerid, params[]) { if(pInfo[playerid][pLevel] >= 2) { new veh[30],vehid; if(sscanf(params, "s[30]", veh)) return SendClientMessage(playerid, red, "Usage: /spawncar <Model ID/Vehicle Name>"); if(IsNumeric(veh)) vehid = strval(veh); else vehid = ReturnVehicleModelID(veh); if(vehid < 400 || vehid > 611) return SendClientMessage(playerid, red, "Invalid vehicle model!"); SpawnVehicle(playerid,vehid); CommandToAdmins(playerid,"spawncar"); return 1; } else return ShowMessage(playerid, red, 1); } |
Type this in your Script :
pawn Код:
|
if(strcmp(cmdtext, "/spawncar") == 0)
{
if(IsPlayerAdmin))
{
new carid; //Line 0
if(sscanf(params, "I", carid)) SendClientMessage(playerid, -1, "[USAGE] /spawncar [carid]"); //Line 1
if(carid < 400 || carid > 611) SendClientMessage(playerid, -1, "[ERROR] Invalid car id!"); //Line 2
new Float:x, Float:y, Float:z; //Line 3
GetPlayerPos(playerid, x, y, z); //Line 4
CreateVehicle(carid, x+2, y, z, 0, 0, 0, -1); //Line 5
SendClientMessage(playerid, -1, "[INFO] Car has been spawned."); //Line 6
return 1;
}
CMD:spawncar(playerid, params[])
{
if(IsPlayerAdmin))
{
new carid;
if(sscanf(params, "I", carid)) SendClientMessage(playerid, -1, "[USAGE] /spawncar [carid]");
if(carid < 400 || carid > 611) SendClientMessage(playerid, -1, "[ERROR] Invalid car id!");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(carid, x+2, y, z, 0, 0, 0, -1);
SendClientMessage(playerid, -1, "[INFO] Car has been spawned.");
return 1;
}