/event problem.
#7

Start using dcmd or zcmd with sscanf, much simpler than calling strtok all the time.

pawn Код:
dcmd_event(playerid, params[])
{
  if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_RED, "Not admin");
  new
    event[32],
    gunid,
    ammo;

  if(sscanf(params, "sii", event, gunid, ammo)) return SendClientMessage(playerid, COLOR_RED, "Usage: /event ...");
 
  if(!strcmp(event, "guns"))
  {
    GivePlayerWeapon(playerid, gunid, ammo);
    // or whatever should happen if an admin types /event guns ..
  }

  if(!strcmp(event, "health))
  {
    SetPlayerHealth(playerid, 100.0);
  }

  if(!strcmp(event, "
teleport))
  {
    SetPlayerPos(playerid, 0.0, 0.0, 5.0);
  }
  return 1;
}
Oh, btw, use the switch function for those gunid's instead of 50 times else if.
Reply


Messages In This Thread
/event problem. - by Razvann - 26.02.2010, 18:58
Re: /event problem. - by Jeffry - 26.02.2010, 19:19
Re: /event problem. - by notime - 26.02.2010, 23:16
Re: /event problem. - by Razvann - 27.02.2010, 13:24
Re: /event problem. - by Jeffry - 27.02.2010, 13:26
Re: /event problem. - by Razvann - 27.02.2010, 13:29
Re: /event problem. - by Vince - 27.02.2010, 13:37
Re: /event problem. - by Jeffry - 27.02.2010, 15:35
Re: /event problem. - by Razvann - 27.02.2010, 15:49

Forum Jump:


Users browsing this thread: 1 Guest(s)