/SPAWN CMD?
#1

Please Help me in making /spawn Command.

I mean Like that /spawn <carname>
Reply
#2

Type this in your Script :


Quote:

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);
}
- J.L Administration System .
Reply
#3

Quote:
Originally Posted by Axey187
Посмотреть сообщение
Type this in your Script :

pawn Код:
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);
}
- J.L Administration System .
i think it wont work.
1.u copied from J.L Administration System so it needs its Defines (which is in the script)
2.u need ZCMD i think
Reply
#4

I didn't script Admin System yet.
Just tell me How to Spawn Cars for RCON Admins?
Reply
#5

I've ZCMD and I made many CMDS from it. But I don't know How to make /spawn Commands. I think We need to define all cars first on starting of our Gamemode?
Reply
#6

Quote:
Originally Posted by MAFIAWARS
Посмотреть сообщение
I've ZCMD and I made many CMDS from it. But I don't know How to make /spawn Commands. I think We need to define all cars first on starting of our Gamemode?
Did This Script Work??
Reply
#7

I didn't try it. Just I want /spawn CMD so the RCON Admin can Spawn the Car.

As you are giving this:


if(pInfo[playerid][pLevel] >= 2)

I know what it means. It means that If Player Admin level 2 so He only can spawn car. But I am new and currently started Scripting so I didn't set Admin System yet.
Reply
#8

Your Script is giving these Errors, Mr.newbie_scripter

E:\Script\gamemodes\Gamemode.pwn(647) : error 017: undefined symbol "pLevel"
E:\Script\gamemodes\Gamemode.pwn(651) : error 017: undefined symbol "IsNumeric"
E:\Script\gamemodes\Gamemode.pwn(652) : error 017: undefined symbol "ReturnVehicleModelID"
E:\Script\gamemodes\Gamemode.pwn(654) : error 017: undefined symbol "SpawnVehicle"
E:\Script\gamemodes\Gamemode.pwn(655) : error 017: undefined symbol "CommandToAdmins"
E:\Script\gamemodes\Gamemode.pwn(65 : error 017: undefined symbol "ShowMessage"
E:\Script\gamemodes\Gamemode.pwn(660) : warning 203: symbol is never used: "aVehicleNames"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#9

I thought this would happen. And it Aint my Script
i can make a script but in DCMD and not RCON
Reply
#10

Be sure to have SSCANF.

strcmp:
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;
}

zcmd:
pawn Код:
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;
}
Should work. All you need to do is get the car ID you want and type /spawncar [carid] and it'll spawn the car next to you. I did it in zcmd & strcmp, hope it works.



Line 0 -Defining "carid".
Line 1 - Putting sscanf in there and telling sscanf we're using "I" which stands for integer (number).
Line 2 - If the player types a car idea that's higher than 611 or lower than 400, it'll send an error message.
Line 3 - Defining x, y, z position (in floats)
Line 4 - Getting a players position in x, y, z.
Line 5 - Using CreateVehicle (a function) to spawn the vehicle. Carid is the ID to spawn and it'll spawn 2 spaces from the x position.
Line 6 - Telling the player the car was spawned.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)