24.01.2013, 22:34
Hi, I need this two commands /calm to calm the server for one minute. In that time no player can use weapons. And /uncalm to finish the quite time and the players can use weapons. Thank you and please USE strcmp.
new bool:pvp;
CMD:pvp(playerid)
{
if(pvp == true)
{
pvp = false;
SendClientMessageToAll(-1,"PVP Disabled!");
}
else
{
pvp = true;
SendClientMessageToAll(-1,"PVP Enabled! Go kill everybody");
}
return 1;
}
//on top of you GM
new Calm;
forward UnsetCalm();
forward GunTimer();
// on game mode init
SetTimer("GunTimer", 5000, 1); // checking every 5 seconds for weapons on server
// ===========
if (strcmp(cmd, "/calm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
calm= 1;
SetTimer("UnsetCalm",60000,false);
}
return 1;
}
if (strcmp(cmd, "/uncalm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
// write here whatever you want
calm= 0;
KillTimer(UnsetCalm);
}
return 1;
}
public UnsetCalm()
{
calm= 0;
return 1;
}
public GunTimer()
{
foreach (Player, i)
{
if(calm = 1)
{
for (new g=0; g<9; g++)
{
new sweapon, sammo;
GetPlayerWeaponData(i, g, sweapon, sammo);
if(sweapon != 0 && sammo != 0)
{
ResetPlayerWeapons(i);
GameTextForPlayer(i, "~w~Server is in~n~~r~peace mode!!!", 5000, 1);
}
}
}
}
return 1;
}
I prefer to use SetPlayerTeam, while server is on the calm state with new function anit-vehicle killing for team mates. However, you can set player healths to god value or check in GlobalTimer every second or in OnPlayerUpdate is player weapon is different than "0", which means FISTS.
|
if(calmState == true) SetPlayerArmedWeapon(playerid, 0);
Hi, here try this...
pawn Код:
|
C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1009) : error 017: undefined symbol "cmd" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1013) : error 017: undefined symbol "calm" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1013) : warning 215: expression has no effect C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1019) : error 017: undefined symbol "cmd" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1024) : error 017: undefined symbol "calm" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1024) : warning 215: expression has no effect C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1025) : error 076: syntax error in the expression, or invalid function call C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1030) : error 029: invalid expression, assumed zero C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1030) : error 004: function "UnsetCalm" is not implemented C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1032) : error 017: undefined symbol "calm" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1032) : warning 215: expression has no effect C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1035) : warning 225: unreachable code C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1035) : error 029: invalid expression, assumed zero C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1035) : error 004: function "GunTimer" is not implemented C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1037) : error 017: undefined symbol "foreach" C:\WINDOWS\security\kidn\Server\xgamemodes\DM.pwn(1039) : error 017: undefined symbol "calm" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1039) : warning 215: expression has no effect C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1039) : error 001: expected token: ";", but found ")" C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1039) : error 029: invalid expression, assumed zero C:\WINDOWS\security\kidn\Server\x\gamemodes\DM.pwn(1039) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 15 Errors.