Warning cames up...
#1

Hey, i created one command: /jail ID Time Reason, but when i compile error comes:

Код:
warning 219: local variable "Time" shadows a variable at a preceding level
And, here is the command:

Код:
dcmd_jail(playerid,params[])
 {
 if(pInfo[playerid][AdminLevel] > 0)
 {
 #pragma unused params
 new ID, Time, Reason[30];
 if(sscanf(params,"iis",ID,Time,Reason))return SendClientMessage(playerid,GREY," Usage: /jail ID Minutes Reason");
 new AdminName[MAX_PLAYER_NAME]; GetPlayerName(playerid,AdminName,MAX_PLAYER_NAME);
 new VictimName[MAX_PLAYER_NAME]; GetPlayerName(playerid,VictimName,MAX_PLAYER_NAME);
 new Message[80]; format(Message,80,"Admin command: %s jailed [ID:%d]%s, for: %dmins. (Reason: %s )",AdminName,ID,VictimName,Time,Reason);
 SendClientMessageToAll(RED,Message);
 SetPlayerInterior(ID, 10);
 SetPlayerPos(ID ,220.5365, 115.1898, 999.0156);
 new JTime = Time*60000;
 SetTimerEx("JailRelease" , JTime, false,"i",playerid);
 pInfo[ID][Jail]=JTime;
 }
 return 1;
 }
Any ideas ?

PS. Command works, message shows perfectly, but about the warning...
Reply
#2

Rename the variable "Time" to "OBTime" for example.
Reply
#3

Quote:
Originally Posted by ¤Adas¤
Rename the variable "Time" to "OBTime" for example.
Oh my god, i feel so shy about this... Thank you. It worked.
Reply
#4

No problem :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)