11.05.2014, 07:19
please help me! this is all of the codes of my event system, (i got it from here https://sampforum.blast.hk/showthread.php?tid=426026)
and i have this errors, please help me!
Код:
#define FILTERSCRIPT
#include <a_samp>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_PINK 0xFF00FFFF
#define COLOR_BLUE 0x006AFFFF
#define COLOR_GREEN 0x00FF54FF
#define COLOR_RED 0xFF2100FF
new Float:XX;
new Float:YY;
new Float:ZZ;
new event = 0;
new intID;
new joinable = 0;
new joined[MAX_PLAYERS];
new etimer;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Event system by [AK]Nazgul");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
joined[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(event, 5, cmdtext);
dcmd(eweapon, 7, cmdtext);
dcmd(winner, 6, cmdtext);
dcmd(start, 5, cmdtext);
dcmd(join, 4, cmdtext);
dcmd(eventover, 9, cmdtext);
dcmd(eventcmds, 9, cmdtext);
return 0;
}
//=======================================dcmd=================================
dcmd_event(playerid,params[])
{
if(event == 0)
{
if(IsPlayerAdmin(playerid))
{
new message33[64];
if(sscanf(params,"s",message33)) return SendClientMessage(playerid,COLOR_RED,"Usage: /event [name]");
new string[128];
format(string,sizeof(string),"~g~ %s has started. ~n~ ~y~Type /join to join the event",message33);
GameTextForAll(string,10000,3);
SendClientMessageToAll(COLOR_GREEN,"You have 1 minute to join");
etimer = SetTimer("Eventtimer",60000,false);
event = 1;
GetPlayerPos(playerid,XX,YY,ZZ);
intID = GetPlayerInterior(playerid);
joinable = 1;
return 1;
}
else{SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); return 1;}
}
else if(event == 1)
{
SendClientMessage(playerid,COLOR_PINK,"An event is already running!");
return 1;
}
return 1;
}
dcmd_join(playerid,params[])
{
if(joinable == 1 && joined[playerid] == 0)
{
SetPlayerPos(playerid, XX, YY, ZZ);
SetPlayerInterior(playerid,intID);
TogglePlayerControllable(playerid,false);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid,100);
joined[playerid] = 1;
SendClientMessage(playerid,COLOR_BLUE,"You have joined the event.");
return 1;
}
else if(joinable == 0 || event == 0)
{
SendClientMessage(playerid,COLOR_BLUE,"There are no events or the current event is already running");
return 1;
}
return 1;
}
dcmd_eventover(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
event = 0;
KillTimer(etimer);
SendClientMessageToAll(COLOR_BLUE,"The event has ended!");
for(new i = 0;i<MAX_PLAYERS; i++)
{
if(joined[i] == 1)
{
joined[i] = 0;
SetPlayerInterior(i,0);
SpawnPlayer(i);
}
}
return 1;
}
else{SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); return 1;}
}
dcmd_start(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
if(event == 1)
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
TogglePlayerControllable(i,true);
GameTextForAll("~g~EVENT STARTS",2000,3);
}
return 1;
}
else{SendClientMessage(playerid,COLOR_RED,"There is no event running."); return 1;}
}
else{SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); return 1;}
}
dcmd_eweapon(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new wID;
if(sscanf(params,"i",wID)) return SendClientMessage(playerid,COLOR_RED,"Usage: /eweapon [weaponid]");
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(joined[i]==1)
{
GivePlayerWeapon(i,wID,9999);
}
}
return 1;
}
else{SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); return 1;}
}
dcmd_winner(playerid,params[])
{
if(event == 1)
{
if(IsPlayerAdmin(playerid))
{
new price, winner;
if(sscanf(params,"ui",winner,price)) return SendClientMessage(playerid,COLOR_RED,"Usage: /winner [ID] [Price]");
new str[128];
format(str,128,"{40E0D0}%s (%i) has won the event, and gained %d",PlayerName(winner),winner,price);
SendClientMessageToAll(-1,str);
GivePlayerMoney(winner,price);
return 1;
}
else{SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); return 1;}
}
else{SendClientMessage(playerid,COLOR_RED,"There is no event running."); return 1;}
}
forward Eventtimer(playerid);
public Eventtimer(playerid)
{
joinable = 0;
SendClientMessageToAll(COLOR_BLUE,"The event can no longer be joined!");
}
dcmd_eventcmds(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,-1," Event commands: </event> - Create an event.");
SendClientMessage(playerid,-1," Event commands: </eweapon> - Give weapons to players in the event.");
SendClientMessage(playerid,-1," Event commands: </start> - Start the event.");
SendClientMessage(playerid,-1," Event commands: </join> - Join an event.");
SendClientMessage(playerid,-1," Event commands: </eventover> - End an event.");
SendClientMessage(playerid,-1," Event commands: </winner> - Announce a winner and give him a price.");
return 1;
}
else{SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); return 1;}
}
//============================================================================
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name)); return name;
}
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (string[stringPos] && string[stringPos] <= ' ')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
new changestr[16], changepos = 0, strpos = stringPos;
while(changepos < 16 && string[strpos] && string[strpos] != delim)
{
changestr[changepos++] = string[strpos++];
}
changestr[changepos] = '\0';
setarg(paramPos,0,_:floatstr(changestr));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
Код:
C:\Users\user\Desktop\eventsystem.pwn(96) : warning 203: symbol is never used: "params" C:\Users\user\Desktop\eventsystem.pwn(117) : warning 203: symbol is never used: "params" C:\Users\user\Desktop\eventsystem.pwn(140) : warning 203: symbol is never used: "params" C:\Users\user\Desktop\eventsystem.pwn(203) : warning 203: symbol is never used: "params" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Warnings.


