/getgun & /armour & /goto command
#1

Hello all,


I am making a Police Training server and I need a way of letting people get guns.


I was hoping to use /getgun then a list would come up like....


1. M4 2. Sniper Rifle 3. Tear Gas
4. Shotgun 5. MP5 ect... ect.. (the sort of guns Police Would have)

The they could do /getgun 1 for an M4 and it would give them 1000 bullets


---------------------------------------------------------------------------

The /armour command,


All I would like is for when a player does /armour (the player must be in a vehicle if possible) It gives them full armour.

----------------------------------------------------------------------------

The /goto command,

As it says anyone can do /goto [id] then they go to that person.





Many Thanks in Advance

Alex
Reply
#2

If you want someone to make a script for you, go to the scripting request thread, here i'll link you.
Reply
#3

All of these will go in the OnPlayerCommandText

/getgun
pawn Код:
if(strcmp(cmd, "/getgun", true) == 0)
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, 0xbbff0000, "/getgun [gunid]");
      SendClientMessage(playerid, 0x99cc0000, "1:Brass Knuckles / 2:Golf Club / 3:Night Stick / 4:Knife / 5:Baseball Bat / 6:Shovel / 7:Pool Cue / 8:Katana / 9:Chainsaw / 10:Purple Dildo");
      SendClientMessage(playerid, 0x99cc0000, "11:Small Vibrator / 12:Large Vibrator / 13:Silver Vibrator / 14:Flowers / 15:Cane / 16:Grenade / 17:Teargas / 18:Molotov Cocktail / 22:Dual 9mm / 23:Silenced 9mm");
      SendClientMessage(playerid, 0x99cc0000, "24:Desert Eagle / 25:Shotgun / 26:Sawn Off Shotgun / 27:Combat Shotgun / 28:Micro SMG / 29:SMG / 30:AK47 / 31:M4 / 32:Tec9 / 33:Country Rifle");
      SendClientMessage(playerid, 0x99cc0000, "34:Sniper Rifle / 35:Rocket Launcher / 36:Heat Seeking Rocket Launcher / 37:Flame Thrower / 38:Mini Gun / 41:Spray Can / 42:Fire Extinguisher / 46:Parachute");
    return 1;
    }
    new tmpgun = strval(tmp);
    if(tmpgun <= 0 || tmpgun == 19 || tmpgun == 20 || tmpgun == 21 || tmpgun == 39 || tmpgun == 40 || tmpgun == 43 || tmpgun == 44 || tmpgun == 45 || tmpgun >= 47)
    {
      SendClientMessage(playerid, 0xff000000 , " >> Invalid weapon ID");
      return 1;
    }
    new str[34];
    GivePlayerWeapon(playerid, tmpgun, 1000);
    format(str, sizeof(str), "You have given yourself weapon %d", tmpgun);
    SendClientMessage(playerid, 0x00bbbb00, str);
    return 1;
  }
/armour
pawn Код:
if(strcmp(cmd, "/armour", true) == 0)
  {
    if(!IsPlayerInAnyVehicle(playerid))
    {
      SendClientMessage(playerid, 0xff000000 , "You must be in a car to use this command.");      
      return 1;
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
      new Float:armor;
      GetPlayerArmour(playerid, armor);
      GivePlayerArmour(playerid, 100-armor); // This will make sure the player gets 100 armor only. Take out the -armor to make it so they get +100 each time they do it.
      SendClientMessage(playerid, 0x00bbbb00 , "Armor Replenished");
      return 1;
    }
    return 1;
  }
/goto
pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, 0xbbff0000 , "/goto [playerid]");
      return 1;
    }
    new tmpplayer = ReturnUser(tmp);
    new Float:tmpx, Float:tmpy, Float:tmpz;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(tmpplayer, name, sizeof(name);
    GetPlayerPos(tmpplayer, tmpx, tmpy, tmpz);
    SetPlayerPos(playerid, tmpx, tmpy, tmpz+1);
    format(str, sizeof(str), "You have teleported to %s(ID:%d)", name, tmpplayer);
    SendClientMessage(playerid, 0x00bbbb00 , str);
    return 1;
  }
I started writing this when there was no posts, and I am sure some people posted already, but I am posting anyways. None of these are tested, and I wrote it right here in the reply box on the forum. Enjoy.
Reply
#4

haha that guy gave me the idea to get armour from the police vans :P here's wut i did:

Код:
  if(strcmp(cmd, "/getarmour", true) == 0)  {
  if(!IsPlayerInAnyVehicle(playerid))  {
  SendClientMessage(playerid, COLOR_ERROR , "This command only works while inside a Police Van.");
  return 1;
  }
  new vehicleid = GetPlayerVehicleID(playerid);
  if(IsPlayerInAnyVehicle(playerid) && GetVehicleModel(vehicleid) != 427 )   {
  SendClientMessage(playerid,COLOR_ERROR,"You can only get armour if you're inside a Police van");
  return 1;
  }
  if(GetVehicleModel(vehicleid) == 427 && IsPlayerInAnyVehicle(playerid)) { //swatvan
  new Float:armor;
  GetPlayerArmour(playerid, armor);
  SetPlayerArmour(playerid, 100-armor); // Take out the -armor to make it so they get +100 each time they do it.
  SendClientMessage(playerid, COLOR_DEADCONNECT , "|_S.A. Police Van_|");
  SendClientMessage(playerid, COLOR_ROYALBLUE , "You grabbed some armor!");
  return 1;
  }

  return 1;
  }
but i was really looking for a /bring or /goto that would move a vehicle because i tried but failed :/ :S i'll have to mess with it some more

and

cheers to the best mod on the net! *clink*

*chugs*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)