Help me for command
#1

PHP код:
#define ARCbank         "Presidents/%s.ini"
    
if(strcmp(cmd"/voteforpresident"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"Използвай: /voteforpresident [NICKNAME]");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            new 
Name[24]; GetPlayerName(playerid,Name,24);
            new 
file[100]; format(file,100,ARCbank,Name);
            if(!
dini_Exists(string))
            {
                  
dini_Create(string);
                      
dini_Set(string"%s"tmp);
                
format(stringsizeof(string), "* You voted for %s. *"tmp);
                        
SendClientMessage(playeridCOLOR_BLUEstring);
                    }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"You are voted!");
            }
        }
        return 
1;
    } 
Reply
#2

what is dat ?u want help with wut ?
Reply
#3

this better
Код:
CMD:poll(playerid, params[])
{
	new string[128];
	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /poll [question]");
	if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128.");
	if(PollOn) return SendClientMessage(playerid, COLOR_GREY, "There is already an poll started.");
	format(string, sizeof(string), "{298EFF}** Question:{FFFFFF} %s {298EFF}**", params);
	SendClientMessageToAll(COLOR_WHITE, string);
	format(string, sizeof(string), "{298EFF}** Press {FFFFFF}Y{298EFF} to vote {FFFFFF}Yes{298EFF}, Press {FFFFFF}N{298EFF} to vote {FFFFFF}No{298EFF}. **");
	SendClientMessageToAll(COLOR_WHITE, string);
	format(string, sizeof(string), "{298EFF}** Poll ending in {FFFFFF}30{298EFF} Seconds. **");
	SendClientMessageToAll(COLOR_WHITE, string);
	PollOn = 1;
	PollN = 0;
	foreach(Player, i)
	{
	        	PollVoted[i] = 0;
	}
	PollY = 0;
	SetTimer("pollend", 30000, false);
	return 1;
}



}

forward pollend(playerid);
public pollend(playerid)
{
	new string[128];
    format(string, sizeof(string), "{298EFF}The Poll has ended, {FFFFFF}%d{298EFF} people voted {FFFFFF}No{298EFF}, {FFFFFF}%d{298EFF} people voted {FFFFFF}Yes.", PollN, PollY);
    SendClientMessageToAll(COLOR_WHITE, string);
    PollOn = 0;
	return 1;
}


// Poll System
new PollVoted[MAX_PLAYERS];
new PollY;
new PollOn;
new PollN;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)