Need help with /jail command (Very Urgent) -
Goldino - 02.02.2013
Hey guys, I have a a jail command, here it is:
Код:
CMD:jail(playerid,params[])
{
new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME];//id = the targetid, time = the jailing time, reason[100]= the reason string in this tutorial i think you know about strings,playername and Gplayername for the jailing names ill explain later
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, lb, "USAGE: /jail <playerid> <time> <reason>");// this is sscanf routine , d=integer and s= string
if(Jailed[id] == 1) return SendClientMessage(playerid, red, "ERROR: Player is already jailed.");// 1 jailed 0 is not jailed
GetPlayerName(id, PlayerName, sizeof(PlayerName));// the jailed person id
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));// the admin id
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason);
SendClientMessageToAll(color, szString);//%s = name . %d = number
SetPlayerInterior(id, 3);//sets player interior
SetPlayerVirtualWorld(id, 10);//sets player vw
SetPlayerFacingAngle(id, 360.0);//player angle
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);//player pos
SetPlayerHealth(id, 9999999999.0);//player cannot be killed
ResetPlayerWeapons(id);//resets his weapons
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);//jail timer
return 1;
}
And I get these errors?
Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1411) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1412) : error 017: undefined symbol "lb"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1413) : error 017: undefined symbol "red"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1416) : error 017: undefined symbol "szString"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1416) : error 017: undefined symbol "szString"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1416) : error 029: invalid expression, assumed zero
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1416) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
Re: Need help with /jail command (Very Urgent) -
Naruto_Emilio - 02.02.2013
pawn Код:
CMD:jail(playerid,params[])
{
new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME], szString[128];//id = the targetid, time = the jailing time, reason[100]= the reason string in this tutorial i think you know about strings,playername and Gplayername for the jailing names ill explain later
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "USAGE: /jail <playerid> <time> <reason>");// this is sscanf routine , d=integer and s= string
if(Jailed[id] == 1) return SendClientMessage(playerid, 0x8B0000FF, "ERROR: Player is already jailed.");// 1 jailed 0 is not jailed
GetPlayerName(id, PlayerName, sizeof(PlayerName));// the jailed person id
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));// the admin id
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason);
SendClientMessageToAll(0x5F9EA0FF, szString);//%s = name . %d = number
SetPlayerInterior(id, 3);//sets player interior
SetPlayerVirtualWorld(id, 10);//sets player vw
SetPlayerFacingAngle(id, 360.0);//player angle
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);//player pos
SetPlayerHealth(id, 9999999999.0);//player cannot be killed
ResetPlayerWeapons(id);//resets his weapons
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);//jail timer
return 1;
}
Re: Need help with /jail command (Very Urgent) -
Rapgangsta - 02.02.2013
CMD:jail(playerid,params[])
{
new zstring[60];
new id,time,reason[100],aPlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME];//id = the targetid, time = the jailing time, reason[100]= the reason string in this tutorial i think you know about strings,playername and Gplayername for the jailing names ill explain later
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, color, "USAGE: /jail <playerid> <time> <reason>");// this is sscanf routine , d=integer and s= string
if(Jailed[id] == 1) return SendClientMessage(playerid, color, "ERROR: Player is already jailed.");// 1 jailed 0 is not jailed
GetPlayerName(id, aPlayerName, sizeof(aPlayerName));// the jailed person id
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));// the admin id
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", aPlayerName, id, time, reason);
SendClientMessageToAll(color, szString);//%s = name . %d = number
SetPlayerInterior(id, 3);//sets player interior
SetPlayerVirtualWorld(id, 10);//sets player vw
SetPlayerFacingAngle(id, 360.0);//player angle
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);//player pos
SetPlayerHealth(id, 9999999999.0);//player cannot be killed
ResetPlayerWeapons(id);//resets his weapons
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);//jail timer
return 1;
}
Re: Need help with /jail command (Very Urgent) -
Goldino - 02.02.2013
Then I get this:
Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1411) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1432) : error 017: undefined symbol "lb"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1433) : error 017: undefined symbol "red"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1434) : error 017: undefined symbol "red"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1454) : error 030: compound statement not closed at the end of file (started at line 1430)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Both jail and unjail commands:
Код:
CMD:unjail(playerid,params[])
{
new id;
if(IsPlayerAdmin(playerid)) {//checks if the player is admin
if(sscanf(params,"u",id)) return SendClientMessage(playerid, lb, "USAGE: /unjail <playerid>");//sscanf routine
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, red, "ERROR: Player is not connected.");//checks if the targetid is connected
if(Jailed[id] == 0) return SendClientMessage(playerid, red, "ERROR: Player is not jailed.");//checks if the id is jailed and if he isnt it will send an error.
Jailed[id] = 0;// sets his jail to 0 = unjailed
SetPlayerInterior(id, 0);//normal int
SetPlayerVirtualWorld(id, 0);//normal vw
SpawnPlayer(id);//respawns player
SetPlayerHealth(id, 100);//sets his health back as 100
KillTimer(JailTimer[id]);//kills the timer
return 1;
}
and
Код:
CMD:jail(playerid,params[])
{
new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME], szString[128];//id = the targetid, time = the jailing time, reason[100]= the reason string in this tutorial i think you know about strings,playername and Gplayername for the jailing names ill explain later
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "USAGE: /jail <playerid> <time> <reason>");// this is sscanf routine , d=integer and s= string
if(Jailed[id] == 1) return SendClientMessage(playerid, 0x8B0000FF, "ERROR: Player is already jailed.");// 1 jailed 0 is not jailed
GetPlayerName(id, PlayerName, sizeof(PlayerName));// the jailed person id
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));// the admin id
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason);
SendClientMessageToAll(0x5F9EA0FF, szString);//%s = name . %d = number
SetPlayerInterior(id, 3);//sets player interior
SetPlayerVirtualWorld(id, 10);//sets player vw
SetPlayerFacingAngle(id, 360.0);//player angle
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);//player pos
SetPlayerHealth(id, 9999999999.0);//player cannot be killed
ResetPlayerWeapons(id);//resets his weapons
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);//jail timer
return 1;
}
Please help
Re: Need help with /jail command (Very Urgent) -
[swat]dragon - 02.02.2013
Try this out
Код:
CMD:unjail(playerid,params[])
{
new id;
if(IsPlayerAdmin(playerid)) {//checks if the player is admin
if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0x006AFFFF, "USAGE: /unjail <playerid>");//sscanf routine
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player is not connected.");//checks if the targetid is connected
if(Jailed[id] == 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player is not jailed.");//checks if the id is jailed and if he isnt it will send an error.
Jailed[id] = 0;// sets his jail to 0 = unjailed
SetPlayerInterior(id, 0);//normal int
SetPlayerVirtualWorld(id, 0);//normal vw
SpawnPlayer(id);//respawns player
SetPlayerHealth(id, 100);//sets his health back as 100
KillTimer(JailTimer[id]);//kills the timer
return 1;
}
Regards to:
Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1411) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1454) : error 030: compound statement not closed at the end of file (started at line 1430)
Isn't related to the lines you posted, so I can't tell
Re: Need help with /jail command (Very Urgent) -
Goldino - 02.02.2013
The problem is in the jail command not the unjail command
Re: Need help with /jail command (Very Urgent) -
[swat]dragon - 02.02.2013
Quote:
Originally Posted by Goldino
The problem is in the jail command not the unjail command
|
It is the unjail, to be more precise:
Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1432) : error 017: undefined symbol "lb"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1433) : error 017: undefined symbol "red"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1434) : error 017: undefined symbol "red"
It means it doesnt recognize "lb" and "red" color on lines:
Код:
if(sscanf(params,"u",id)) return SendClientMessage(playerid, lb, "USAGE: /unjail <playerid>");//sscanf routine
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, red, "ERROR: Player is not connected.");//checks if the targetid is connected
if(Jailed[id] == 0) return SendClientMessage(playerid, red, "ERROR: Player is not jailed.");//checks if the id is jailed and if he isnt it will send an error.
are you sure you defined them with:
Код:
#define red 0xFF0000FF
#define lb 0x006AFFFF
Re: Need help with /jail command (Very Urgent) -
Goldino - 02.02.2013
plz help