04.12.2010, 18:05
Hello i want to do this cmds only for admins but it's not working.'
pawn Код:
dcmd_lightfw(playerid, params[])
{
new distance;
if(PlayerInfo[playerid][Level] >= 1) return SendClientMessage(playerid, RED, "Sorry, only members can use fireworks.");
if(AllowedFirework[DrawDistance] == 0) distance = 15;
if(AllowedFirework[DrawDistance] == 1) distance = 22;
if(AllowedFirework[DrawDistance] == 2) distance = 30;
if(!strlen(params))
{
SendClientMessage(playerid, WHITE, "USAGE: /lightfw [type]");
SendClientMessage(playerid, COLOR_WHITE, "Types: Firecracker, crackerroll, firerocket1, firerocket2, fountain1, fountain2, fountain3, rocketbox");
return 1;
}
if(strcmp("firecracker", params, true, 8) == 0)
{
if(AllowedFirework[FireCracker] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[FireCracker] == 0)
{
if(firecrackertime[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
firecrackertime[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s throws away a firecracker.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, 8);
Firecracker[playerid] = CreateObject(1672, X,Y,(Z-0.9), 0, 0, 0);
SetTimerEx("FirecrackerTime", (2000+(random(3000))), 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already threw a firecracker.");
}
else return SendClientMessage(playerid, RED, "ERROR: Only members can use fireworks.");
}
if(strcmp("crackerroll", params, true, 11) == 0)
{
if(AllowedFirework[Crackerroll] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[Crackerroll] == 0)
{
if(firecrackerroll[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
firecrackerroll[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s Places down a firecracker roll.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, 8);
FireCrackerRoll[playerid] = CreateRoll(playerid,X,Y,(Z-1.00));
RollStartX[playerid] = X;
RollStartY[playerid] = Y;
RollStartZ[playerid] = (Z-1.00);
CrackerRollSmoke[playerid] = CreateObject(2780, X, Y, (Z-5.00), 0, 0, 0);
SetTimerEx("CrackerRollTime", (2000+(random(3000))), 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already placed a firecracker roll.");
}
else return SendClientMessage(playerid, RED, "ERROR: The CrackerRoll is enabled for rcon admins only");
}
if(strcmp("firerocket1", params, true, 11) == 0)
{
if(AllowedFirework[Firerocket1] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[Firerocket1] == 0)
{
if(firerockettime[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
firerockettime[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s lights up a fire rocket.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, distance);
Firerocket[playerid] = CreateObject(354, X,Y,(Z), 0, 0, 0);
rocketsmoke[playerid] = CreateObject(2780, X,Y,(Z), 0, 0, 0);
MoveObject(Firerocket[playerid], X, Y, Z+30, 10);
MoveObject(rocketsmoke[playerid], X, Y, Z+30, 10);
SetTimerEx("FirerocketTime", 3000, 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already lightd a firerocket.");
}
else return SendClientMessage(playerid, RED, "ERROR: The FireRocket 1 is enabled for rcon admins only");
}
if(strcmp("firerocket2", params, true, 11) == 0)
{
if(AllowedFirework[Firerocket2] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[Firerocket2] == 0)
{
if(firerockettime[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
firerockettime[playerid] = 2;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s lights up a fire rocket.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, distance);
Firerocket[playerid] = CreateObject(354, X,Y,(Z), 0, 0, 0);
rocketsmoke[playerid] = CreateObject(2780, X,Y,(Z), 0, 0, 0);
MoveObject(Firerocket[playerid], X, Y, Z+50, 15);
MoveObject(rocketsmoke[playerid], X, Y, Z+50, 15);
SetTimerEx("FirerocketTime", 3000, 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already Light a firerocket.");
}
else return SendClientMessage(playerid, RED, "ERROR: The FireRocket 2 is enabled for rcon admins only");
}
if(strcmp("fountain1", params, true, 9) == 0)
{
if(AllowedFirework[Fountain1] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[Fountain1] == 0)
{
if(Fountain1Time[playerid] == 0 && Fountain2Time[playerid] == 0 && Fountain3Time[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
Fountain1Time[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s places a Firework Fountain on the ground.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, 15);
FTX[playerid] = X;
FTY[playerid] = Y;
FTZ[playerid] = (Z-1.0);
Fountain[playerid] = CreateObject(354, X,Y,(Z-1.0), 0, 0, 0);
FountainSmoke[playerid] = CreateObject(2780, X,Y,(Z-1.0), 0, 0, 0);
SetTimerEx("FountainTimer", 3000, 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already Light a Firework Fountain.");
}
else return SendClientMessage(playerid, RED, "ERROR: The Fountain 1 is enabled for rcon admins only");
}
if(strcmp("fountain2", params, true, 9) == 0)
{
if(AllowedFirework[Fountain2] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[Fountain2] == 0)
{
if(Fountain1Time[playerid] == 0 && Fountain2Time[playerid] == 0 && Fountain3Time[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
Fountain2Time[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s places a Firework Fountain on the ground.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, 15);
FTX[playerid] = X;
FTY[playerid] = Y;
FTZ[playerid] = (Z-1.0);
Fountain[playerid] = CreateObject(354, X,Y,(Z-1.0), 0, 0, 0);
FountainSmoke[playerid] = CreateObject(2780, X,Y,(Z-1.0), 0, 0, 0);
SetTimerEx("FountainTimer", 3000, 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already Light a Firework Fountain.");
}
else return SendClientMessage(playerid, RED, "ERROR: The Fountain 2 is enabled for rcon admins only");
}
if(strcmp("fountain3", params, true, 9) == 0)
{
if(AllowedFirework[Fountain3] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[Fountain3] == 0)
{
if(Fountain1Time[playerid] == 0 && Fountain2Time[playerid] == 0 && Fountain3Time[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
Fountain3Time[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s places a Firework Fountain on the ground.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, 15);
FTX[playerid] = X;
FTY[playerid] = Y;
FTZ[playerid] = (Z-1.0);
Fountain[playerid] = CreateObject(354, X,Y,(Z-1.0), 0, 0, 0);
FountainSmoke[playerid] = CreateObject(2780, X,Y,(Z-1.0), 0, 0, 0);
SetTimerEx("FountainTimer", 3000, 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already Light a Firework Fountain.");
}
else return SendClientMessage(playerid, RED, "ERROR: The Fountain 3 is enabled for rcon admins only");
}
if(strcmp("rocketbox", params, true, 9) == 0)
{
if(AllowedFirework[RocketB] == 1 && IsPlayerAdmin(playerid) || AllowedFirework[RocketB] == 0)
{
if(RocketBoxTime[playerid] == 0)
{
new Float:X, Float:Y,Float:Z;
RocketBoxTime[playerid] = 1;
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s places a Rocketbox on the ground.", sendername);
ProxDetector(15.0, playerid, string, WHITE,WHITE,WHITE,WHITE,WHITE);
GetPlayerPos(playerid,X,Y,Z);
GetXYInFrontOfPlayer(playerid, X,Y, distance);
RBX[playerid] = X;
RBY[playerid] = Y;
RBZ[playerid] = (Z-1.0);
RocketBox[playerid] = CreateObject(354, X,Y,(Z-1.0), 0, 0, 0);
RocketBoxSmoke[playerid] = CreateObject(2780, X,Y,(Z-1.0), 0, 0, 0);
SetTimerEx("RocketBoxTimer", 3000, 0, "i", playerid);
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You already Light a Firework RocketBox.");
}
else return SendClientMessage(playerid, RED, "ERROR: The RocketBox is enabled for rcon admins only");
}
else return SendClientMessage(playerid, WHITE, "USAGE: /lightfirework [type]");
}