Imam promblem kod komande /tod ovako ide komanda:
if(strcmp(cmd, "/tod", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KORISTI: /tod [timeofday] (0-23)");
return 1;
}
new hour;
hour = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
SetWorldTime(hour);
format(string, sizeof(string), " Vrijeme je postavljeno na %d sati.", hour);
BroadCast(COLOR_GRAD1, string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Nisi Admin !");
}
}
return 1;
}
I onda kad ocu compile mi izbaci ovo:
C:\Users\Korisnik\Desktop\K-Admin.pwn(1035) : error 017: undefined symbol "tmp"
C:\Users\Korisnik\Desktop\K-Admin.pwn(1036) : error 017: undefined symbol "tmp"
C:\Users\Korisnik\Desktop\K-Admin.pwn(1042) : error 017: undefined symbol "tmp"
C:\Users\Korisnik\Desktop\K-Admin.pwn(1043) : error 017: undefined symbol "PlayerInfo"
C:\Users\Korisnik\Desktop\K-Admin.pwn(1043) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\K-Admin.pwn(1043) : error 001: expected token: ";", but found "]"
C:\Users\Korisnik\Desktop\K-Admin.pwn(1043) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\K-Admin.pwn(1043) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
7 Errors.
A eto primjera jedne komande ako vam pomaze:
if(strcmp("/mute", cmd, true) == 0)
{
new tmp[256], cmdid;
tmp = strtok(cmdtext, idx);
if(GetPlayerLevel(playerid) < 2) return SendClientMessage(playerid, cream, "Nisi Admin !");
if(!strlen(tmp)) return SendClientMessage(playerid, cream, "KORISTI: /mute [ID]");
if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, cream, "Taj igrac nije aktivan");
if(GetPlayerWired(strval(tmp)) == 1) return SendClientMessage(playerid, cream, "Taj igrac je vec usutkan");
cmdid = strval(tmp);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new oname[MAX_PLAYER_NAME];
GetPlayerName(cmdid, oname, sizeof(oname));
if(Untouch[cmdid] == 0) TogglePlayerWired(cmdid, 1);
new string[256];
format(string, sizeof(string), "\"%s\" je usutkan od Admina \"%s\"", oname, pname);
SendClientMessageToAll(yellow, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerLevel(i) > 0)
{
new lvlstring[256], aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
format(lvlstring, sizeof(lvlstring), "(( Admin \"%s\" je napisao komandu \"%s\" ))", aname, cmdtext[0]);
SendClientMessage(i, green, lvlstring);
}
}
return 1;
}
Mozete mi pomoc kako da ispravim error i da mi komanda radi Hvala
if(strcmp(cmd, "/tod", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /tod [timeofday] (0-23)");
return 1;
}
new hour;
hour = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
SetWorldTime(hour);
format(string, sizeof(string), " Time set to %d Hours.", hour);
BroadCast(COLOR_GRAD1, string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
Nisam gledoa tvoju komandu ali evo ovo sam procesljao,valjda ce ti pomoci . . .
Definiraj ''tmp'' ;)
Izdvoji liniju 1043 i postaj
Iznad ove linije:
tmp = strtok(cmdtext, idx);
stavi ovo:
new tmp;
Ovako mi sada ide komanda:
if(strcmp(cmd, "/tod", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmp;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, hotpink, "KORISTI: /tod [timeofday] (0-23)");
return 1;
}
new hour;
hour = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
SetWorldTime(hour);
format(string, sizeof(string), " Vrijeme je postavljeno na %d sati.", hour);
BroadCast(hotpink, string);
}
else
{
SendClientMessage(playerid, red, " Nisi Admin !");
}
}
return 1;
}
ali onda kada compile onda mi ovo izbaci
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1358) : error 006: must be assigned to an array
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1359) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1365) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1366) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1366) : warning 215: expression has no effect
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1366) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1366) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\K-Admin.pwn(1366) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
7 Errors.
[Saw]BloodMaster hvala smanjilo mi je errore ali ima novih :S