SA-MP Forums Archive
Error O.o - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error O.o (/showthread.php?tid=374452)



Error O.o - Gooday - 02.09.2012

pawn Код:
CMD:jail(playerid, params[])
{
   if (Cop[playerid]==0)
   {
       new targetid, minutes;
       if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, COLOR_ORANGE,"Usage: /jail <playerid> <minutes>");
       if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, COLOR_CRIMSON, "Minutes can't be less than 0 or more than 60.");
       if(targetid == playerid) return SendClientMessage(playerid, COLOR_CRIMSON, "You can't jail yourself!");
        else
        {
        new str[128]; //create a new string
        LINE 1976 = format(str, sizeof(str), "[Sentence] %s has been jailed by %s for %d minutes.", Name(targetid), Name(playerid), minutes);
        SendClientMessageToAll(COLOR_GREY,str);
        JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false);
        SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391);
        SetPlayerInterior(playerid, 6);
        inJail[targetid] = 1;
        GameTextForPlayer(playerid, "~p~JAILED", 10000, 6);
        PlayerPlaySound(targetid,1057,0.0,0.0,0.0);
        }
    }
        else return SendClientMessage(playerid, COLOR_CRIMSON, "You are not a member of the SP/SD.");
        return 1;
}
Quote:

C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1976) : error 012: invalid function call, not a valid address
C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1976) : warning 215: expression has no effect
C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1976) : error 001: expected token: ";", but found ")"
C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1976) : error 029: invalid expression, assumed zero
C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1976) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Thanks!


Re : Error O.o - ricardo178 - 02.09.2012

DELETE THIS MESSAGE


Re : Error O.o - ricardo178 - 02.09.2012

Replace:
pawn Код:
new str[128]; //create a new string
        LINE 1976 = format(str, sizeof(str), "[Sentence] %s has been jailed by %s for %d minutes.", Name(targetid), Name(playerid), minutes);
With:
pawn Код:
new str[128]; //create a new string
new Name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(targetid, PlayerName, sizeof(PlayerName));
format(str, sizeof(str), "[Sentence] %s has been jailed by %s for %d minutes.", Name, PlayerName, minutes);
Also this:
pawn Код:
if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, COLOR_ORANGE,"Usage: /jail <playerid> <minutes>");
To this:
pawn Код:
if(sscanf(params, "ui", targetid, minutes)) return SendClientMessage(playerid, COLOR_ORANGE,"Usage: /jail <playerid> <minutes>");