/jail command. Whats wrong here?
#1

Hey there,

This command has no errors, but doesn't work at all. Can someone tell me whats wrong? I would appreciate it, since my pawno knowledge isnt very advanced.

Код:
if(strcmp(cmdtext, "/ajail", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE/UŻYCIE: /ajail [ID]");
{
if (IsPlayerConnected(giveplayerid))
         {
        SetPlayerInterior(playerid, 6);
        SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
          SetCameraBehindPlayer(playerid);
          new pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname, sizeof (pname));
          format(stringl, sizeof(stringl), "*** %s has been jailed by Admin / został uwięziony przez Admina: %s.", pname, pname);
          SendClientMessageToAll(COLOR_ADMIN, stringl);
          printf(stringl);
          return 1;
          }else{
        format(stringl, sizeof(stringl), "ID %d is not an active player / nie jest aktywnym graczem!", giveplayerid);
        SendClientMessage(playerid, COLOR_GREY, stringl);

     }
   }
   }
      return 1;
  }
And is that unjail command correct too?
Код:
if(strcmp(cmdtext, "/aunjail", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid,2139.2112,1000.7551,10.8203);
        SendClientMessage(playerid,COLOR_GREEN, "*** You have been released from jail / Zostałes zwolniony z więzienia!");
			  }
	 return 1;
	 }
Thanks and Regards
Puzi
Reply
#2

You have no id system so giveplayerid = means nothing
Reply
#3

Ah well, how to make this id system?
Reply
#4

Use strtok, or switch to dcmd and sscanf, which is easier to use in my opinion.
Reply
#5

I have strtok in my script, and I dont think using dcmd or sscanf will help me, im dumb at pwn, sry
Reply
#6

Yes, you have it, but you need to use it
https://sampwiki.blast.hk/wiki/Strtok
Reply
#7

Код:
	if(strcmp(cmd, "/ajail", true) == 0)
	{
		new tmp[128];
		tmp = strtok(cmdtext, idx);

		if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE/UŻYCIE: /kick [playerid]");

		Jail(strval(tmp));
		return 1;
		}
{
if (IsPlayerConnected(giveplayerid))
         {
        SetPlayerInterior(playerid, 6);
        SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
          SetCameraBehindPlayer(playerid);
          new pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname, sizeof (pname));
          format(stringl, sizeof(stringl), "*** %s has been jailed by Admin / został uwięziony przez Admina: %s.", pname, pname);
          SendClientMessageToAll(COLOR_ADMIN, stringl);
          printf(stringl);
          return 1;
          }else{
        format(stringl, sizeof(stringl), "ID %d is not an active player / nie jest aktywnym graczem!", giveplayerid);
        SendClientMessage(playerid, COLOR_GREY, stringl);

     }
   }
   }
      return 1;
  }
Fuck, please help. I get load of errors
Reply
#8

pawn Код:
if(strcmp(cmdtext, "/ajail", true,6) == 0)
{
    if(!strlen(cmdtext[7])) return SendClientMessage(playerid, COLOR_WHITE, "USAGE/UŻYCIE: /kick [playerid]");
    if(IsPlayerConnected(strval(cmdtext[7])))
    {
        SetPlayerPos(strval(cmdtext[7]),264.6288,77.5742,1001.0391);
        SetPlayerInterior(strval(cmdtext[7]), 6);
        SetCameraBehindPlayer(strval(cmdtext[7]));
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(strval(cmdtext[7]), pname, sizeof (pname));
        format(stringl, sizeof(stringl), "*** %s has been jailed by Admin / został uwięziony przez Admina: %s.", pname,pname);
        SendClientMessageToAll(COLOR_ADMIN, stringl);
        printf(stringl);
    }else{
        format(stringl, sizeof(stringl), "ID %d is not an active player / nie jest aktywnym graczem!", strval(cmdtext[7]));
        SendClientMessage(playerid, COLOR_GREY, stringl);
    }
    return 1;
}
Cheerz.
Reply
#9

When I compile, I get a crash
Reply
#10

It works fine for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)