Help -
TheDarkBlade - 21.02.2016
Код:
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42646) : error 033: array must be indexed (variable "winner")
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42648) : warning 202: number of arguments does not match definition
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42649) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42649) : error 017: undefined symbol "prize"
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42649) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42649) : fatal error 107: too many error messages on one line
PHP код:
CMD:dmwinner(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_LIGHTRED,"Logheazate mai intai");
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new winner[50];
if(sscanf(params, "u",winner)) return SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /dmwinner <Name/Playerid>");
if(winner != INVALID_PLAYER_ID) ///46246
{
SendClientMessageToAll(COLOR_GREEN,"%s a castigat eventul DM! Felicitari",winner); // 46248
GivePlayerCash(playerid, + prize);
activeevent = 0;
}
else
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Acel player nu este conectat");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
}
}
return 1;
}
i did define the prize in this command
PHP код:
CMD:startdmevent(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_LIGHTRED,"Logheazate mai intai");
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >=3)
{
new prize;
if(sscanf(params, "d",prize)) return SendClientMessage(playerid, 0xFFFFFFFF, "{B8DBFF}Comanda: /startdmevent <premiu> ");
else if (prize<1 || prize>500000) return SendClientMessage(playerid,COLOR_YELLOW,"Premiul trebuie sa fie intre 1 si 500k");
if(activeevent == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFB870}Deja exista un event in derulare.");
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
SendClientMessageToAll(COLOR_YELLOW2,"Adminul %s a pornit DM event!",aname);
SendClientMessageToAll(COLOR_YELLOW2,"Premiu : $%s",prize);
SendClientMessageToAll(COLOR_YELLOW,"Pentru a participa scrie /joinevent");
Count = 0;
activeevent = 1;
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
}
}
return 1;
}
I'm a newbie scripter
Re: Help -
TheDarkBlade - 21.02.2016
bump
Re: Help -
SyS - 21.02.2016
u only defined prize in 2nd cmd define it first one 2 and winner should be indexed
Right code
PHP код:
CMD:dmwinner(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_LIGHTRED,"Logheazate mai intai");
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new winner[50];
new prize;
if(sscanf(params, "u",winner[])) return SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /dmwinner <Name/Playerid>");
if(winner[] != INVALID_PLAYER_ID) ///46246
{
SendClientMessageToAll(COLOR_GREEN,"%s a castigat eventul DM! Felicitari",winner[]); // 46248
GivePlayerCash(playerid, + prize);
activeevent = 0;
}
else
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Acel player nu este conectat");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
}
}
return 1;
}
Re: Help -
TheDarkBlade - 21.02.2016
Код:
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42653) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42654) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42656) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : warning 215: expression has no effect
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : error 001: expected token: ";", but found ")"
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : error 029: invalid expression, assumed zero
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : fatal error 107: too many error messages on one line
Re: Help -
SyS - 21.02.2016
try this
PHP код:
CMD:dmwinner(playerid,params[])
{
if(gPlayerLogged(playerid) == 0) return SendClientMessage(playerid,COLOR_LIGHTRED,"Logheazate mai intai");
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new winner[50];
new prize;
if(sscanf(params, "u",winner[])) return SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /dmwinner <Name/Playerid>");
if(winner[] != INVALID_PLAYER_ID) ///46246
{
SendClientMessageToAll(COLOR_GREEN,"%s a castigat eventul DM! Felicitari",winner[]); // 46248
GivePlayerCash(playerid, + prize);
activeevent = 0;
}
else
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Acel player nu este conectat");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
}
}
return 1;
}
if not worked show the definition of gPlayerLogged
Re: Help -
TheDarkBlade - 21.02.2016
Код:
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : error 001: expected token: ";", but found ")"
C:\Users\TheDarkBlade\Desktop\xMA.pwn(42657) : error 029: invalid expression, assumed zero
Re: Help -
TheDarkBlade - 21.02.2016
bump
Re: Help -
Hellman92 - 21.02.2016
Show me the lines?
Re: Help -
TheDarkBlade - 21.02.2016
PHP код:
CMD:dmwinner(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_LIGHTRED, "Logheazate mai intai");
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new idw[50];
new prize;
if(sscanf(params, "u",idw[])) return SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /dmwinner <Name/Playerid>");
if(idw[] != INVALID_PLAYER_ID)
{
SendClientMessageToAll(COLOR_GREEN,"%s a castigat eventul DM! Felicitari",idw[]);
GivePlayerCash(idw, + prize); //42657
activeevent = 0;
}
else
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Acel player nu este conectat");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
}
}
return 1;
}
Re: Help -
LocMax - 21.02.2016
PHP код:
CMD:dmwinner(playerid,params[])
{
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid,COLOR_LIGHTRED, "Logheazate mai intai");
// You can use ! which is equal to == 0
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
// Shortened few lines doing the above
new idw, prize;
if(sscanf(params, "ui",idw,prize)) return SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /dmwinner <Name/Playerid> <Prize>");
if(idw == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Acel player nu este conectat");
new str[60], name[MAX_PLAYER_NAME]; // you need to create a string to format the message below and a name array to get the player's name
GetPlayerName(idw, name, sizeof(name)); // here we get the target player's name
format(str,sizeof(str), "%s a castigat eventul DM! Felicitari", name); // we have to format the message
SendClientMessageToAll(COLOR_GREEN, str); // show the message to everybody
GivePlayerCash(idw, prize); // give the money, amount defined using /dmwinner <playerid> <money>
activeevent = 0;
return 1;
}