SA-MP Forums Archive
CMD Error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD Error (/showthread.php?tid=613286)



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
PHP код:
[CODE][/CODE
It's hard to see if you don't use it.


Re: CMD Error - SyS - 26.07.2016

PHP код:
CMD:givecash(playeridparams[])
{
//check if the player is a admin
LevelCheck(playerid3);
new 
targetamount;
if(
sscanf(params"ui"targetamount)) return SendClientMessage(playeridCOLOR_THISTLE"USAGE: /givecash [player] [amount]");
printf("tid = %d pid = %d" ,target,playerid);
if(!
IsPlayerConnected(target)) return SendClientMessage(playeridCOLOR_FIREBRICK"ERROR: The specified player is not conected.");
GivePlayerMoney(targetamount);
PlayerPlaySound(target10570.00.00.0);
PlayerPlaySound(playerid10570.00.00.0);
new 
string[144];
format(stringsizeof(string), "admin %s[%i] has given you money $%i."ReturnPlayerName(playerid), playeridamount);
SendClientMessage(targetCOLOR_DODGER_BLUEstring);
format(stringsizeof(string), "You have given %s[%i]'s money $%i."ReturnPlayerName(target), targetamount);
SendClientMessage(playeridCOLOR_DODGER_BLUEstring);
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(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        if(
AdminDuty[playerid] != && 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], giveplayeridmoney;
        if(
sscanf(params"ud"giveplayeridmoney)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /givemoney [playerid/partofname] [money]");

        if(
IsPlayerConnected(giveplayerid))
        {
            
GivePlayerCash(giveplayeridmoney);
            
format(stringsizeof(string), "You have given %s $%d!",GetPlayerNameEx(giveplayerid),money);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
format(stringsizeof(string), "%s has given %s $%d (via /givemoney)"GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
            
Log("logs/adminmoney.log"string);
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_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(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        if(
AdminDuty[playerid] != && 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], giveplayeridmoney;
        if(
sscanf(params"ud"giveplayeridmoney)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /givemoney [playerid/partofname] [money]");
        if(
IsPlayerConnected(giveplayerid))
        {
            
GivePlayerCash(giveplayeridmoney);
            
format(stringsizeof(string), "You have given %s $%d!",GetPlayerNameEx(giveplayerid),money);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
format(stringsizeof(string), "%s has given %s $%d (via /givemoney)"GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
            
Log("logs/adminmoney.log"string);
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_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?