GiveAllScore does NOT give score to players -
iAnonymous - 23.05.2014
Hello mates ,
pawn Код:
CMD:giveallscore(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if(admin(playerid)>3)
{
new ammount;
if(!sscanf(params, "i", ammount))
{
new string[500];
sendadmincmd(playerid,"GIVEALLSCORE");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
format(string,100,"(admin) You have given all players score %d.",ammount);
SendClientMessage(playerid,COLOR_ORANGERED,string);
format(string,100,"~b~ADMIN: ~w~~h~You have given all players score %d.",ammount);
message(playerid,string,5000);
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
format(string,500,"(admin) Administrator ''%s(%d)'' have given all players score %d.",pNick(playerid),playerid,ammount);
SendClientMessage(i,COLOR_ORANGERED,string);
PlayerPlaySound(i,1057,0.0,0.0,0.0);
format(string,500,"~b~ADMIN: ~w~~h~Administrator ''%s(%d)'' have given all players score %d.",pNick(playerid),playerid,ammount);
message(i,string,5000);
switch(random(5))
{
case 0: PlayerInfo[i][dmscore]++;
case 1: PlayerInfo[i][racescore]++;
case 2: PlayerInfo[i][timescore]++;
case 3: PlayerInfo[i][groupscore]++;
case 4: PlayerInfo[i][duelscore]++;
}
SetPlayerScore(i,GetPlayerScore(i)+ammount);
}
}
}else SendClientMessage(playerid, COLOR_MAROON,"(admin) /Giveallscore (ammount)."),message(playerid,"~b~ADMIN: ~w~~h~Correct usage: /Giveallscore (ammount).",5000);
}else message(playerid,"~b~ADMIN: ~w~~h~Access denied, You don't have privillage to this command.",5000),SendClientMessage(playerid,COLOR_MAROON,"(admin) Access denied, You don't have privillage to this command.");
}
return 1;
}
Re: GiveAllScore does NOT give score to players -
Fred1993 - 23.05.2014
pawn Код:
new score;
score = (GetPlayerScore(i) + amount);
SetPlayerScore(i, score);
Try this maybe it helps
Re : GiveAllScore does NOT give score to players -
S4t3K - 23.05.2014
Without any explaination more ?
Also, this code is clearer and looks better.
PHP код:
CMD:giveallscore(playerid,params[])
{
if(!IsPlayerConnected(playerid)) return 1;
if(admin(playerid) < 3) return message(playerid,"~b~ADMIN: ~w~~h~Access denied, You don't have privillage to this command.",5000),SendClientMessage(playerid,COLOR_MAROON,"(admin) Access denied, You don't have privillage to this command.");
new ammount;
if(sscanf(params, "i", ammount)) return SendClientMessage(playerid, COLOR_MAROON,"(admin) /Giveallscore (ammount)."),message(playerid,"~b~ADMIN: ~w~~h~Correct usage: /Giveallscore (ammount).",5000);
new string[145];
sendadmincmd(playerid,"GIVEALLSCORE");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
format(string, 144,"(admin) You have given all players score %d.",ammount);
SendClientMessage(playerid,COLOR_ORANGERED,string);
format(string,144,"~b~ADMIN: ~w~~h~You have given all players score %d.",ammount);
message(playerid,string,5000);
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
format(string,144,"(admin) Administrator ''%s(%d)'' have given all players score %d.",pNick(playerid),playerid,ammount);
SendClientMessage(i,COLOR_ORANGERED,string);
PlayerPlaySound(i,1057,0.0,0.0,0.0);
format(string,140,"~b~ADMIN: ~w~~h~Administrator ''%s(%d)'' have given all players score %d.",pNick(playerid),playerid,ammount);
message(i,string,5000);
switch(random(5))
{
case 0: PlayerInfo[i][dmscore]++;
case 1: PlayerInfo[i][racescore]++;
case 2: PlayerInfo[i][timescore]++;
case 3: PlayerInfo[i][groupscore]++;
case 4: PlayerInfo[i][duelscore]++;
default: PlayerInfo[i][dmscore]++;
}
SetPlayerScore(i,GetPlayerScore(i)+ammount);
}
}
return 1;
}
I've added a "default" case in the switch, replace what it does by whatever you want, and also, what doesn't work ?
Re: GiveAllScore does NOT give score to players -
iAnonymous - 23.05.2014
Thanks alot mate .
It worked .