/stadium [stadium id] problem
#1

hey guys i really have a big problem.

i have took some script parts from the GF gm to script me a command in which i type /stadium and then a space and then the stadium id.

but it always takes the first id even when i write /stadium 5 or so.

pls help.

Код:
	if (strcmp(cmd, "/stadium", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			new staid[16];
			strmid(staid, tmp, 0, strlen(cmdtext), 255);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				format(string, sizeof(string), "USAGE: /buygun [gunname] [ammoamount]");
				return 1;
			}
			if (strcmp(staid, "1", true, strlen(staid)) == 0)
			{
				SetPlayerPos(playerid, -1394.20, 987.62, 1023.96);
				SetPlayerInterior(playerid, 15);
				ResetPlayerWeapons(playerid);
			}
			else if (strcmp(staid, "2", true, strlen(staid)) == 0)
			{
				SetPlayerPos(playerid, -1424.9319, -664.5869, 1059.8585);
				SetPlayerInterior(playerid, 4);
				ResetPlayerWeapons(playerid);
			}
			else if (strcmp(staid, "3", true, strlen(staid)) == 0)
			{
				SetPlayerPos(playerid, -1395.958, -208.197, 1051.170);
				SetPlayerInterior(playerid, 7);
				ResetPlayerWeapons(playerid);
			}
			else if (strcmp(staid, "4", true, strlen(staid)) == 0)
			{
				SetPlayerPos(playerid, -1079.99, 1061.58, 1343.04);
				SetPlayerInterior(playerid, 10);
				ResetPlayerWeapons(playerid);
			}
			else
			{
			  SendClientMessage(playerid, COLOR_RED, "  Invalid staidum id ! ");
			  return 1;
			}
		}
		return 1;
	}
Reply
#2

shoulndt you use case 0; or wat ever insted it might work like case o
case 1
case 2 and so on
Reply
#3

pawn Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
    format(string, sizeof(string), "USAGE: /buygun [gunname] [ammoamount]");
    return 1;
}
new staid[16];
strmid(staid, tmp, 0, strlen(tmp), 255);
Reply
#4

You could always use ZCMD.

First download the include from the attachment..

Next, add "#include <zcmd>" on the top of your script under "#include <a_samp>"

Then put the include into your pawno/include/ folder..

Then, add this command anywhere (not under any public):

pawn Код:
zcmd(stadium, playerid, params[])
{
    new place;
    if(!sscanf(params, "i", place))
    {
      if(place == 1)
      {
        SetPlayerPos(playerid, -1394.20, 987.62, 1023.96);
            SetPlayerInterior(playerid, 15);
            ResetPlayerWeapons(playerid);
      }
      else if(place == 2)
      {
        SetPlayerPos(playerid, -1424.9319, -664.5869, 1059.8585);
            SetPlayerInterior(playerid, 4);
            ResetPlayerWeapons(playerid);
      }
      else if(place == 3)
      {
          SetPlayerPos(playerid, -1395.958, -208.197, 1051.170);
            SetPlayerInterior(playerid, 7);
            ResetPlayerWeapons(playerid);
      }
      else if(place == 4)
      {
        SetPlayerPos(playerid, -1079.99, 1061.58, 1343.04);
            SetPlayerInterior(playerid, 10);
            ResetPlayerWeapons(playerid);
      }
      else
      {
        SendClientMessage(playerid, COLOR_RED, "Error: Invalid Stadium ID!");
      }
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Stadium [ID]"); //Feel free to change whatever.
    return 1;
}
You could also add SendClientMessageToAll to tell everyone on the server that somebody has joined a stadium.. Just add:

pawn Код:
new name[MAX_PLAYER_NAME];
new string[128]; //I know, you could probably limit this more, but meh.
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has joined Stadium Number %d!", name, place);
SendClientMessageToAll(COLOR_WHITE, string); //Just change the color.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)