if(strcmp(cmd, "/event", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /event [guns,health,teleport]");
return 1;
}
if(strcmp(x_nr,"guns",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /event guns [gunid][ammo]");
return 1;
}
new gun;
new ftext[50];
if(gun == 1) { ftext = "Brass Knuckles"; }
else if(gun == 2) { ftext = "Golf Club"; }
else if(gun == 3) { ftext = "NightStick"; }
else if(gun == 4) { ftext = "Knife"; }
else if(gun == 5) { ftext = "Baseball Bat"; }
else if(gun == 6) { ftext = "Shovel"; }
else if(gun == 7) { ftext = "Pool Cue"; }
else if(gun == 8) { ftext = "Katana"; }
else if(gun == 9) { ftext = "Chainsaw"; }
else if(gun == 10) { ftext = "Purple Dildo"; }
else if(gun == 11) { ftext = "Small White Vibrator"; }
else if(gun == 12) { ftext = "Large White Vibrator"; }
else if(gun == 13) { ftext = "Silver Vibrator"; }
else if(gun == 14) { ftext = "Flowers"; }
else if(gun == 15) { ftext = "Cane"; }
else if(gun == 16) { ftext = "Grenade"; }
else if(gun == 17) { ftext = "Tear Gas"; }
else if(gun == 18) { ftext = "Molotov Cocktail"; }
else if(gun == 22) { ftext = "9MM"; }
else if(gun == 23) { ftext = "Silenced 9mm"; }
else if(gun == 24) { ftext = "Desert Eagle"; }
else if(gun == 25) { ftext = "Shotgun"; }
else if(gun == 26) { ftext = "Sawn-off Shotgun"; }
else if(gun == 27) { ftext = "Combat Shotgun"; }
else if(gun == 28) { ftext = "Micro SMG"; }
else if(gun == 29) { ftext = "MP5"; }
else if(gun == 30) { ftext = "AK-47"; }
else if(gun == 31) { ftext = "M4"; }
else if(gun == 32) { ftext = "Tec9"; }
else if(gun == 33) { ftext = "Country Rifle"; }
else if(gun == 34) { ftext = "Sniper Rifle"; }
else if(gun == 35) { ftext = "Rocket Launcher"; }
else if(gun == 36) { ftext = "HS Rocket Launcher"; }
else if(gun == 37) { ftext = "Flamethrower"; }
else if(gun == 38) { ftext = "Minigun"; }
else if(gun == 41) { ftext = "Spraycan"; }
else if(gun == 42) { ftext = "Fire Extinguisher"; }
else if(gun == 43) { ftext = "Camera"; }
else if(gun == 44) { ftext = "Nightvision Goggle"; }
else if(gun == 45) { ftext = "Thermal Goggles"; }
else if(gun == 46) { ftext = "Parachutte"; }
new ammo;
gun = strval(tmp);
if(gun < 1||gun > 46||gun==27||gun==1||gun==2||gun==9||gun==17||gun==19||gun==20||gun==21||gun==36||gun==38||gun==39||gun==40||gun==44||gun==45)
{ SendClientMessage(playerid, COLOR_GRAD1, " wrong WeaponID!"); return 1; }
ammo = strval(tmp);
if(ammo <1 ||ammo > 999)
{ SendClientMessage(playerid, COLOR_GRAD1, " dont go below 1 or above 999 bullets!"); return 1; }
for(new i;i<MAX_PLAYERS;i++)
{
GivePlayerWeapon(i, gun, ammo);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "You have received a %s with %d ammo from admin %s.",ftext,ammo,sendername);
SendClientMessage(i,0xC84200AA,string);
format(string, 256, "[EVENT]: %s has gived a %s with %d ammo.",sendername,ftext,ammo);
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
}
}
}
return 1;
}
if(strcmp(cmd, "/event", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /event [guns,health,teleport]");
return 1;
}
if(strcmp(x_nr,"guns",true) == 0)
{
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /event guns [gunid][ammo]");
return 1;
}
new gun;
new ftext[50];
gun = strval(tmp);
if(gun == 1) { ftext = "Brass Knuckles"; }
else if(gun == 2) { ftext = "Golf Club"; }
else if(gun == 3) { ftext = "NightStick"; }
else if(gun == 4) { ftext = "Knife"; }
else if(gun == 5) { ftext = "Baseball Bat"; }
else if(gun == 6) { ftext = "Shovel"; }
else if(gun == 7) { ftext = "Pool Cue"; }
else if(gun == 8) { ftext = "Katana"; }
else if(gun == 9) { ftext = "Chainsaw"; }
else if(gun == 10) { ftext = "Purple Dildo"; }
else if(gun == 11) { ftext = "Small White Vibrator"; }
else if(gun == 12) { ftext = "Large White Vibrator"; }
else if(gun == 13) { ftext = "Silver Vibrator"; }
else if(gun == 14) { ftext = "Flowers"; }
else if(gun == 15) { ftext = "Cane"; }
else if(gun == 16) { ftext = "Grenade"; }
else if(gun == 17) { ftext = "Tear Gas"; }
else if(gun == 18) { ftext = "Molotov Cocktail"; }
else if(gun == 22) { ftext = "9MM"; }
else if(gun == 23) { ftext = "Silenced 9mm"; }
else if(gun == 24) { ftext = "Desert Eagle"; }
else if(gun == 25) { ftext = "Shotgun"; }
else if(gun == 26) { ftext = "Sawn-off Shotgun"; }
else if(gun == 27) { ftext = "Combat Shotgun"; }
else if(gun == 28) { ftext = "Micro SMG"; }
else if(gun == 29) { ftext = "MP5"; }
else if(gun == 30) { ftext = "AK-47"; }
else if(gun == 31) { ftext = "M4"; }
else if(gun == 32) { ftext = "Tec9"; }
else if(gun == 33) { ftext = "Country Rifle"; }
else if(gun == 34) { ftext = "Sniper Rifle"; }
else if(gun == 35) { ftext = "Rocket Launcher"; }
else if(gun == 36) { ftext = "HS Rocket Launcher"; }
else if(gun == 37) { ftext = "Flamethrower"; }
else if(gun == 38) { ftext = "Minigun"; }
else if(gun == 41) { ftext = "Spraycan"; }
else if(gun == 42) { ftext = "Fire Extinguisher"; }
else if(gun == 43) { ftext = "Camera"; }
else if(gun == 44) { ftext = "Nightvision Goggle"; }
else if(gun == 45) { ftext = "Thermal Goggles"; }
else if(gun == 46) { ftext = "Parachutte"; }
new ammo;
if(gun < 1||gun > 46||gun==27||gun==1||gun==2||gun==9||gun==17||gun==19||gun==20||gun==21||gun==36||gun==38||gun==39||gun==40||gun==44||gun==45)
{ SendClientMessage(playerid, COLOR_GRAD1, " wrong WeaponID!"); return 1; }
ammo = strval(tmp2);
if(ammo <1 ||ammo > 999)
{ SendClientMessage(playerid, COLOR_GRAD1, " dont go below 1 or above 999 bullets!"); return 1; }
for(new i;i<MAX_PLAYERS;i++)
{
GivePlayerWeapon(i, gun, ammo);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "You have received a %s with %d ammo from admin %s.",ftext,ammo,sendername);
SendClientMessage(i,0xC84200AA,string);
format(string, 256, "[EVENT]: %s has gived a %s with %d ammo.",sendername,ftext,ammo);
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
}
}
}
return 1;
}
for(new i;i<MAX_PLAYERS;i++) { GivePlayerWeapon(i, gun, ammo); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, 256, "You have received a %s with %d ammo from admin %s.",ftext,ammo,sendername); SendClientMessage(i,0xC84200AA,string); format(string, 256, "[EVENT]: %s has gived a %s with %d ammo.",sendername,ftext,ammo); SendClientMessageToAll(COLOR_LIGHTRED, string); return 1;<<<here }
Originally Posted by Jeffry
pawn Код:
I can test it tomorrow, if it wont work now. |
new tmp[256];
warning 219: local variable "tmp" shadows a variable at a preceding level error 017: undefined symbol "tmp2" - x2
dcmd_event(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_RED, "Not admin");
new
event[32],
gunid,
ammo;
if(sscanf(params, "sii", event, gunid, ammo)) return SendClientMessage(playerid, COLOR_RED, "Usage: /event ...");
if(!strcmp(event, "guns"))
{
GivePlayerWeapon(playerid, gunid, ammo);
// or whatever should happen if an admin types /event guns ..
}
if(!strcmp(event, "health))
{
SetPlayerHealth(playerid, 100.0);
}
if(!strcmp(event, "teleport))
{
SetPlayerPos(playerid, 0.0, 0.0, 5.0);
}
return 1;
}