Errorr -.- =>
#1

PHP код:
dcmd_jail (playeridparams[])
{
    new 
giveidtimestr[128];
    if (!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You can't use this cmd.");
    if (
sscanf(params"ui"giveidtime)) return SendClientMessage(playerid, -1"USAGE: /jail [ID] [TimeInMilliSeconds]");
    if (
giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Invalid player ID!");
    
CagePlayer(giveid);
    
format(strsizeof(str), "You are now jailed for %i milliseconds!"time);
    
SendClientMessage(giveid, -1str);
    
jailtimer SetTimerEx("UnJailPlayer"timefalse"i"giveid);
    return 
1;

PHP код:
:\Documents and Settings\Arlind\Desktop\fsdf\filterscripts\Project.pwn(5980) : error 017undefined symbol "jailtimer"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Reply
#2

Solution;


Код:
dcmd_jail (playerid, params[]) 
{ 
    new giveid, time, str[128], jailtimer; 
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You can't use this cmd."); 
    if (sscanf(params, "ui", giveid, time)) return SendClientMessage(playerid, -1, "USAGE: /jail [ID] [TimeInMilliSeconds]"); 
    if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player ID!"); 
    CagePlayer(giveid); 
    format(str, sizeof(str), "You are now jailed for %i milliseconds!", time); 
    SendClientMessage(giveid, -1, str); 
    jailtimer = SetTimerEx("UnJailPlayer", time, false, "i", giveid); 
    return 1; 
}
Reply
#3

Half baked solution. Even though that may compile, the variable and the value it contains will be lost as soon as the function ends.
Reply
#4

PHP код:
C:\Documents and Settings\Arlind\Desktop\fsdf\filterscripts\Project.pwn(5980) : warning 204symbol is assigned a value that is never used"jailtimer"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


1 Warning

Reply
#5

Quick question, why do you even need to define the timer ?

Just simply go straight to it without defining it.

Код:
dcmd_jail (playerid, params[]) 
{ 
    new giveid, time, str[128], jailtimer; 
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You can't use this cmd."); 
    if (sscanf(params, "ui", giveid, time)) return SendClientMessage(playerid, -1, "USAGE: /jail [ID] [TimeInMilliSeconds]"); 
    if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player ID!"); 
    CagePlayer(giveid); 
    format(str, sizeof(str), "You are now jailed for %i milliseconds!", time); 
    SendClientMessage(giveid, -1, str); 
    SetTimerEx("UnJailPlayer", time, false, "i", giveid); 
    return 1; 
}
Quote:
Originally Posted by Vince
Посмотреть сообщение
Half baked solution. Even though that may compile, the variable and the value it contains will be lost as soon as the function ends.
@Vince Half assed reply to a help topic
Reply
#6

His reply was more helpful than your code that you failed to proof-read.
Reply
#7

Put new jailtimer; at top of your script (where you place your global variables)..

pawn Код:
// at top
new jailtimer;
///////////

dcmd_jail (playerid, params[])
{
    new giveid, time, str[128];
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You can't use this cmd.");
    if (sscanf(params, "ui", giveid, time)) return SendClientMessage(playerid, -1, "USAGE: /jail [ID] [TimeInMilliSeconds]");
    if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player ID!");
    CagePlayer(giveid);
    format(str, sizeof(str), "You are now jailed for %i milliseconds!", time);
    SendClientMessage(giveid, -1, str);
    jailtimer = SetTimerEx("UnJailPlayer", time, false, "i", giveid);
    return 1;
}

forward UnJailPlayer (playerid);
public UnJailPlayer(playerid)
{
    UnCagePlayer(playerid);
    KillTimer(jailtimer);
    SendClientMessage(playerid, -1, "You are now unjailed!");
    return 1;
}
Reply
#8

add define jailtimer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)