8 Warnings in Jail-Command
#1

I get these eight warnings when I try to compile this command in my script:

Код:
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(407) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(407) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(409) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(409) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(411) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(411) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(411) : warning 202: number of arguments does not match definition
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(411) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Warnings.
PHP код:
    CMD:jail(playeridparams[])
    {
        new 
idminsstr[128];
        new 
JailTimer[MAX_PLAYERS];
        if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid,COLOR_RED,"You need to be level 4 to use that command!");
            if(
sscanf(params"us[128]"idmins))
            return 
SendClientMessage(playerid,TEAM_GROVE_COLOR,"USAGE: /jail [ID][MINS]");
        if (
id == INVALID_PLAYER_ID)
            return 
SendClientMessage(playerid,COLOR_RED,"Error: Player is not connected!");
            
        new 
Name[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
        
GetPlayerName(playeridNamesizeof(Name));
          
GetPlayerName(idName2sizeof(Name2));
        
SetPlayerPos(playerid264.417677.89301001.0391);
        
SetPlayerInterior(playerid6);
        
JailTimer[id] = SetTimerEx("Unjail"mins*60*10000"d"id);
        
format(strsizeof(str), "You jailed %s for %d mins."GetPlayerName(id), mins); //warning
        
SendClientMessage(playeridTEAM_GROVE_COLORstr);
        
format(strsizeof(str), "%s jailed you for %d mins."GetPlayerName(playerid), mins); //warning
        
SendClientMessage(idCOLOR_REDstr);
        
format(strsizeof(str), "Administrator %s has jailed %s for %d mins!"GetPlayerName(playerid),GetPlayerName(id), mins); //warning
        
SendClientMessageToAll(COLOR_REDstr);
        return 
1;
    } 
Reply
#2

GetPlayerName Syntax:
pawn Код:
GetPlayerName(playerid, const name[], len)
Your way of using it:
pawn Код:
GetPlayerName(id)
What are you missing?
Reply
#3

Ehh, I don't really know what to change now, I am confused!
Reply
#4

Quote:
Originally Posted by CookieJar
Посмотреть сообщение
GetPlayerName Syntax:
pawn Код:
GetPlayerName(playerid, const name[], len)
Your way of using it:
pawn Код:
GetPlayerName(id)
What are you missing?
'nuff said.


GRR, screw you anti-spam!
Reply
#5

Ye, I can't get him, I've already, didn't I? Also, I don't know how to use it, I get these errors:

PHP код:
    CMD:jail(playeridparams[])
    {
        new 
idminsstr[128];
        new 
JailTimer[MAX_PLAYERS];
        if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid,COLOR_RED,"You need to be level 4 to use that command!");
            if(
sscanf(params"us[128]"idmins))
            return 
SendClientMessage(playerid,TEAM_GROVE_COLOR,"USAGE: /jail [ID][MINS]");
        if (
id == INVALID_PLAYER_ID)
            return 
SendClientMessage(playerid,COLOR_RED,"Error: Player is not connected!");
            
        new 
Name[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
        
GetPlayerName(playeridNamesizeof(Name));
          
GetPlayerName(idName2sizeof(Name2));
        
SetPlayerPos(playerid264.417677.89301001.0391);
        
SetPlayerInterior(playerid6);
        
JailTimer[id] = SetTimerEx("Unjail"mins*60*10000"d"id);
        
format(strsizeof(str), "You jailed %s for %d mins."GetPlayerName(playerid, const name[], len), mins); //error
        
SendClientMessage(playeridTEAM_GROVE_COLORstr);
        
format(strsizeof(str), "%s jailed you for %d mins."GetPlayerName(playerid, const name[], len), mins);
        
SendClientMessage(idCOLOR_REDstr);
        
format(strsizeof(str), "Administrator %s has jailed %s for %d mins!"GetPlayerName(playerid, const name[], len), GetPlayerName(playerid, const name[], len), mins);
        
SendClientMessageToAll(COLOR_REDstr);
        return 
1;
    } 
Код:
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(407) : error 029: invalid expression, assumed zero
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(407) : error 017: undefined symbol "name"
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(407) : error 029: invalid expression, assumed zero
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(407) : fatal error 107: too many error messages on one line

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


4 Errors.
Reply
#6

Replace this
pawn Код:
format(str, sizeof(str), "You jailed %s for %d mins.", GetPlayerName(playerid, const name[], len), mins);
To
pawn Код:
format(str, sizeof(str), "You jailed %s for %d mins.", Name2, mins);
Also, this
pawn Код:
format(str, sizeof(str), "%s jailed you for %d mins.", GetPlayerName(playerid, const name[], len), mins);
To
pawn Код:
format(str, sizeof(str), "%s jailed you for %d mins.", Name, mins);
Last,
pawn Код:
format(str, sizeof(str), "Administrator %s has jailed %s for %d mins!", GetPlayerName(playerid, const name[], len), GetPlayerName(playerid, const name[], len), mins);
To
pawn Код:
format(str, sizeof(str), "Administrator %s has jailed %s for %d mins!", Name, Name2, mins);
These are the parameters
pawn Код:
GetPlayerName(playerid, const name[], len)
So, you make a new variable with MAX_PLAYER_NAME.
pawn Код:
new
    Name[ MAX_PLAYER_NAME ];

GetPlayerName( playerid, Name, sizeof( Name ) ); // We get the Name from the player and we store it to `Name`
On the format messages, you have to use "%s" -> Name.
It will show the name.
Reply
#7

pawn Код:
enum pInfo
{
    pAdmin,
}

new PlayerInfo[MAX_PLAYERS][pInfo];
new JailTimer[MAX_PLAYERS]; // Should be outside as it's a global variabel.

command(jail, playerid, params[])
{
    new pID, Minutes, string[128];
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0x0, "You need to be level 4 to use that command!");
    if(sscanf(params, "ui", pID, Minutes)) return SendClientMessage(playerid, 0x0, "USAGE: /jail [ID][MINS]");
    if(pID == INVALID_PLAYER_ID || !IsPlayerConnected(pID)) return SendClientMessage(playerid, 0x0, "Error: Player is not connected!");

    SetPlayerPos(pID, 264.4176, 77.8930, 1001.0391);
    SetPlayerInterior(pID, 6);
    JailTimer[pID] = SetTimerEx("Unjail", Minutes * 60 * 1000, 0, "d", pID);
    format(string, sizeof(string), "You jailed %s for %d minutes.", GetPlayerNameEx(pID), Minutes); //warning
    SendClientMessage(playerid, 0x0, string);
    format(string, sizeof(string), "%s jailed you for %d minutes.", GetPlayerNameEx(playerid), Minutes); //warning
    SendClientMessage(pID, 0x0, string);
    format(string, sizeof(string), "Administrator %s has jailed %s for %d mins!", GetPlayerNameEx(playerid), GetPlayerNameEx(pID), Minutes); //warning
    SendClientMessageToAll(0x0, string);
    return 1;
}

stock GetPlayerNameEx(playerid)
{
    new pName[25];
    GetPlayerName(playerid, pName, 25);
    return pName;
}
Didn't test ..
Reply
#8

@Dwane

Well, no errors, but when I type: /jail 0 1, there's written that I jailed myself for 49 minutes! :O
It should be only 1 minute, not 49! Also, a player is able to escape with /kill... He shouldn't be able to type any command inside there! ><
Reply
#9

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
@Dwane

Well, no errors, but when I type: /jail 0 1, there's written that I jailed myself for 49 minutes! :O
It should be only 1 minute, not 49! Also, a player is able to escape with /kill... He shouldn't be able to type any command inside there! ><
The script you wrote was intended to jail yourself, take a look at my earlier reply, i think it should work.
Reply
#10

Works perfectly, but 2 more things!

1. The player doesn't come out the jail (lol) and when he should get released, I want a textdraw appearing: "You are unjailed for now"! Also, I wanna get him released after the time, I was jailin' me for 1 minute, and I waited for 5 minutes, while I still am in the jail! ><

2. The player shouldn't be able to use any command while he's in the jail!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)