CMD Error -
HassanShah - 26.07.2016
Can not give cash to myself.it says that the player is not connected. Plz solve the problem..
CMD:givecash(playerid, params[])
{
//check if the player is a admin
LevelCheck(playerid, 3);
new target, amount;
if(sscanf(params, "ui", target, amount)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /givecash [player] [amount]");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: The specified player is not conected.");
GivePlayerMoney(target, amount);
PlayerPlaySound(target, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
new string[144];
format(string, sizeof(string), "admin %s[%i] has given you money $%i.", ReturnPlayerName(playerid), playerid, amount);
SendClientMessage(target, COLOR_DODGER_BLUE, string);
format(string, sizeof(string), "You have given %s[%i]'s money $%i.", ReturnPlayerName(target), target, amount);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
return 1;
}
Re: CMD Error - Quinncell - 26.07.2016
Use
It's hard to see if you don't use it.
Re: CMD Error -
SyS - 26.07.2016
PHP код:
CMD:givecash(playerid, params[])
{
//check if the player is a admin
LevelCheck(playerid, 3);
new target, amount;
if(sscanf(params, "ui", target, amount)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /givecash [player] [amount]");
printf("tid = %d pid = %d" ,target,playerid);
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: The specified player is not conected.");
GivePlayerMoney(target, amount);
PlayerPlaySound(target, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
new string[144];
format(string, sizeof(string), "admin %s[%i] has given you money $%i.", ReturnPlayerName(playerid), playerid, amount);
SendClientMessage(target, COLOR_DODGER_BLUE, string);
format(string, sizeof(string), "You have given %s[%i]'s money $%i.", ReturnPlayerName(target), target, amount);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
return 1;
}
tell us what is printing on log
Re: CMD Error -
HassanShah - 26.07.2016
It is saying the specified player isn't connected..
Re: CMD Error -
SyS - 26.07.2016
Quote:
Originally Posted by HassanShah
It is saying the specified player isn't connected..
|
what? i said what is printing on server log after using the code i given.
Re: CMD Error -
HassanShah - 26.07.2016
its working, repted ;p
Re: CMD Error -
Usama651 - 26.07.2016
PHP код:
CMD:givemoney(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128], giveplayerid, money;
if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemoney [playerid/partofname] [money]");
if(IsPlayerConnected(giveplayerid))
{
GivePlayerCash(giveplayerid, money);
format(string, sizeof(string), "You have given %s $%d!",GetPlayerNameEx(giveplayerid),money);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s has given %s $%d (via /givemoney)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
Log("logs/adminmoney.log", string);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}
use this its better or need more help in script contact me on fb ********.com/usamakhalid666
Re: CMD Error -
SyS - 26.07.2016
Quote:
Originally Posted by HassanShah
its working, repted ;p
|
all did what i just put a printf statement and it started to work ...well ok then lol
Quote:
Originally Posted by Usama651
PHP код:
CMD:givemoney(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128], giveplayerid, money;
if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemoney [playerid/partofname] [money]");
if(IsPlayerConnected(giveplayerid))
{
GivePlayerCash(giveplayerid, money);
format(string, sizeof(string), "You have given %s $%d!",GetPlayerNameEx(giveplayerid),money);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s has given %s $%d (via /givemoney)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
Log("logs/adminmoney.log", string);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}
use this its better or need more help in script contact me on fb ********.com/usamakhalid666
|
do you think it will work? no for sure. cause these copy pasted thing will give him error as the vars in his script and this one doesnt match.
Re: CMD Error -
Luicy. - 26.07.2016
Quote:
Originally Posted by HassanShah
its working, repted ;p
|
He didn't even change any code.. You do realise print(..) just 'echo's in the console and nothing else?