Offline ban[+REP]
#1

Код:
CMD:oban(playerid,params[])
{
				new id, string[500];
				if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"USAGE:{FFFFFF}/oban [ACCOUNT NAME]");
				if(dini_Exists(Account(id)))
	    	    {
	    	    banned[id] = 1;
       			dini_IntSet(Account(id),"banned",banned[id]);
				format(string,sizeof(string),""COL_LIME"Account %s has been banned",id);
				SendClientMessageToAll(COLOR_YELLOW,string);
				return 1;
	    	    }
	    	    else
	    	    {
	        	    SendClientMessage(playerid, -1, "That player does not exist!");
	    	    }
	    	    return 1;
}
So, when i go ingame and I do /oban, if the player is offline it doesnt ban him, player must be online, but i want it for offline ban.
Reply
#2

use specifier "i" or "d" instead of "u", because "u" is for playernames/ids of players that are online

Edit:

I am assuming that your "Account(id)" function works properly.
Reply
#3

I go try now, will reply.
Reply
#4

It's offline ban, Which means the player is not online. How can you ban him with his ID? lol
You should ban with his name, not ID.
Reply
#5

Quote:
Originally Posted by oMa37
Посмотреть сообщение
It's offline ban, Which means the player is not online. How can you ban him with his ID? lol
You should ban with his name, not ID.
His Account function is probably retrieving the players file through a unique id, at least thats what i thought, which is probably totally wrong
Otherwise,i couldn't think of a reason why he even called his parameter "id"
Reply
#6

dude really? it's just new id; it doesnt specify the id of a player, you could enter anything.
Reply
#7

u didn't even get what i mean

i was talking about your naming, you called it id , so i thought you have some kind of unique id in your player files.
Reply
#8

You want do this ? :
PHP код:
CMD:oban(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_RED"USAGE:{FFFFFF}/oban [ACCOUNT NAME]");
    
    new
        
account[40] = "Accounts/";
    
strcat(accountstrcat);
    
strins(account".ini");
    
    if(!
dini_Exists(account)) return SendClientMessage(playerid, -1"That player does not exist!");
    
dini_IntSet(account"banned"1);
    
    new
        
string[64];
    
    
format(stringsizeof(string), ""COL_LIME"Account %s has been banned"params);
    
SendClientMessageToAll(COLOR_YELLOW,string);
    
    return 
1;

Reply
#9

here comes this
Код:
CMD:ofban(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE:{FFFFFF}/oban [ACCOUNT NAME]");

    new
        account[40] = "users/";

    strcat(account, strcat);
    strins(account, ".ini");

    if(!dini_Exists(account)) return SendClientMessage(playerid, -1, "That player does not exist!");

    dini_IntSet(account, "banned", 1);

    new
        string[64];

    format(string, sizeof(string), ""COL_LIME"Account %s has been banned", params);
    SendClientMessageToAll(COLOR_YELLOW,string);

    return 1;
}
Код:
C:\Users\John\Desktop\projects 2016\ESDS 0.3.7 NEW\gamemodes\ESDS.pwn(4650) : error 076: syntax error in the expression, or invalid function call
Reply
#10

PHP код:
CMD:ofban(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_RED"USAGE:{FFFFFF}/oban [ACCOUNT NAME]");
    new
        
account[40] = "users/";
    
strcat(accountparams);
    
strins(account".ini");
    if(!
dini_Exists(account)) return SendClientMessage(playerid, -1"That player does not exist!");
    
dini_IntSet(account"banned"1);
    new
        
string[64];
    
format(stringsizeof(string), ""COL_LIME"Account %s has been banned"params);
    
SendClientMessageToAll(COLOR_YELLOW,string);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)