Help me for command - 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: Help me for command (
/showthread.php?tid=553408)
Help me for command -
Cr3dO - 29.12.2014
PHP код:
#define ARCbank "Presidents/%s.ini"
if(strcmp(cmd, "/voteforpresident", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Използвай: /voteforpresident [NICKNAME]");
return 1;
}
tmp = strtok(cmdtext, idx);
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(string, sizeof(string), "* You voted for %s. *", tmp);
SendClientMessage(playerid, COLOR_BLUE, string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are voted!");
}
}
return 1;
}
Re : Help me for command -
MCZOFT - 29.12.2014
what is dat ?u want help with wut ?
Re: Help me for command -
Trevor Gin - 29.12.2014
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;