SA-MP Forums Archive
CMD Does not working - 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 Does not working (/showthread.php?tid=619591)



CMD Does not working - DavidGravelli - 19.10.2016

CMD Does not working here is the CMD

pawn Код:
CMD:sethours(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        new targetid, hours, string[150];
        if(sscanf(params, "ud", targetid, hours)) return SendClientMessage(playerid, -1, "{FF8C00}[USAGE] {FFFFFF}/sethours [playerid] [hours]");
        PlayerInfo[targetid][pHours] = hours;
        format(string, sizeof(string), "{FF8C00}[INFO] {FFFFFF}You edited %s's hours to %d.", targetid, hours);
        SendClientMessage(playerid, -1, string);
        SendClientMessage(targetid, -1, "{FF8C00}[INFO] {FFFFFF}Your hours were edited. Check your /stats.");
        return 1;
    }
    else return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You are unauthorized to use this command.");
}



Re: CMD Does not working - ThatFag - 19.10.2016

Whats the problem with it you dont get any errors while compling or you it doesnt work at all
explain more please


Re: CMD Does not working - Airblog - 19.10.2016

If it gives you error use this:
Код:
CMD:sethours(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 5) { new targetid, hours, string[150]; if(sscanf(params, "ud", targetid, hours)) return SendClientMessage(playerid, -1, "{FF8C00}[USAGE] {FFFFFF}/sethours [playerid] [hours]"); PlayerInfo[targetid][pHours] = hours; format(string, sizeof(string), "{FF8C00}[INFO] {FFFFFF}You edited %s's hours to %d.", targetid, hours); SendClientMessage(playerid, -1, string); SendClientMessage(targetid, -1, "{FF8C00}[INFO] {FFFFFF}Your hours were edited. Check your /stats."); return 1; } else return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You are unauthorized to use this command."); 
return 1;}



Re: CMD Does not working - DavidGravelli - 19.10.2016

nah when i type it in game its say Unknown Command.


Re: CMD Does not working - ThatFag - 19.10.2016

Код:
CMD:sethours(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 5)
	{
 		new iPlayer, hours, string[150];
 	    if(sscanf(params, "ud", iPlayer, hours)) return SendClientMessage(playerid, -1, "{FF8C00}[USAGE] {FFFFFF}/sethours [playerid] [hours]");
 	    if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND);
		format(string, sizeof(string), "{FF8C00}[INFO] {FFFFFF}You edited %s's hours to %d.", iPlayer, hours);
		SendClientMessage(playerid, -1, string);
		SendClientMessage(targetid, -1, "{FF8C00}[INFO] {FFFFFF}Your hours were edited. Check your /stats.");
		PlayerInfo[iPlayer][pHours] = hours;
	}
	else return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You are unauthorized to use this command.");
	return 1;
}
try this one.


Re: CMD Does not working - DavidGravelli - 19.10.2016

still not working.


Re: CMD Does not working - ThatFag - 19.10.2016

Код:
CMD:sethours(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 5) return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You are unauthorized to use this command.");
	new iPlayer, iHours;
	if( sscanf ( params, "ud", iPlayer, iHours)) return SCP(playerid, "[PlayerID/PartOfName] [lvl]");
	if(!IsPlayerConnected(iPlayer)) return SendClientMessage(playerid, -1 , "Player Not Connected");
	PlayerInfo[iPlayer][pHours]=iHours;
	SendClientMessage(iPlayer, -1, "{FF8C00}[INFO] {FFFFFF}Your hours were edited. Check your /stats.");
	return 1;
}
This must work

Edited.


Re: CMD Does not working - DavidGravelli - 19.10.2016

Still not working its say SERVER:UNKNOWN COMMAND


Re: CMD Does not working - ThatFag - 19.10.2016

are you using a filterscript or a gamemode ??


Re: CMD Does not working - DavidGravelli - 19.10.2016

Gamemode