help whit cmd /sanoff
#1

pawn Код:
COMMAND:sanoff(playerid, params[]){
new name[MAX_PLAYER_NAME],tmpcarcel,minutes;
if(!(date[playerid][pAdmin] == 5 || IsPlayerAdmin(playerid))) return 0;
if(sscanf(params, "s[24]d",name,minutes)) return SendClientMessage(playerid,-1,"/sanoff [Name] [Mins]");
new string[128];
format(string,sizeof(string),CuentasA,name);
if(!fexist(string)) return SendClientMessage(playerid,-1,"Error.");
new INI:File = INI_Open(string);
tmpcarcel = minutes * 60;
date[name][pSanTime] = gettime() + tmpcarcel;
date[name][pSan] = 1;
date[name][pTeam] = 0;
INI_WriteInt(File,"San",1);
INI_WriteInt(File,"SanTime",minutes*60);
format(string,128,"[CMD|OFF-LINE] %s san %d min. adm: %s",name,minutes,Nombre(playerid));
Informar(string);
INI_Close(File);
return 1;}
Problem:

Код:
 (1505) : error 033: array must be indexed (variable "name")
 (1506) : error 033: array must be indexed (variable "name")
 (1507) : error 033: array must be indexed (variable "name")
lines:
Код:
date[name][pSanTime] = gettime() + tmpcarcel;
date[name][pSan] = 1;
date[name][pTeam] = 0;
Help.
Reply
#2

change "s[24]" in sscanf with "u"
Reply
#3

Quote:
Originally Posted by Florin48
Посмотреть сообщение
change "s[24]" in sscanf with "u"
what?

why?

this is command off-line...
Reply
#4

this is the line with error?

date[name][pSanTime] = gettime() + tmpcarcel;
date[name][pSan] = 1;
date[name][pTeam] = 0;

you cant use name like string in this situation.
Reply
#5

Code:
Quote:

COMMANDanoff(playerid, params[]){
new name[MAX_PLAYER_NAME],tmpcarcel,minutes;
if(!(date[playerid][pAdmin] == 5 || IsPlayerAdmin(playerid))) return 0;
if(sscanf(params, "u",name,minutes)) return SendClientMessage(playerid,-1,"/sanoff [Name] [Mins]");
new string[128];
format(string,sizeof(string),CuentasA,name);
if(!fexist(string)) return SendClientMessage(playerid,-1,"Error.");
new INI:File = INI_Open(string);
tmpcarcel = minutes * 60;
date[name][pSanTime] = gettime() + tmpcarcel;
date[name][pSan] = 1;
date[name][pTeam] = 0;
INI_WriteInt(File,"San",1);
INI_WriteInt(File,"SanTime",minutes*60);
format(string,128,"[CMD|OFF-LINE] %s san %d min. adm: %s",name,minutes,Nombre(playerid));
Informar(string);
INI_Close(File);
return 1;}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)