Problem With Command Creating
#1

Hi All.I Have Code Like This And I Want To Do A Command For It.To Turn On Security Or Turn Off..I Try Do That By My Self But I don't know how to make it.If you know and can help me please help


Код:
public OnPlayerUpdate(playerid)
{

if(IsPlayerInRangeOfPoint(playerid, 32.0, -2904.4456,472.9688,4.9141))
{
if(playerDB[playerid][specialybe] != 1)
{
new Float:burnx, Float:burny, Float:burnz; GetPlayerPos(playerid,burnx, burny, burnz); CreateExplosion(burnx, burny , burnz, 7,10.0);//Explode
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,COLOR_WHITE,"* You Ar Intruder So You Been Removed From This Place!!!.");
new msg[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"**[Security] %s Try to intrude to your police place.",name);
SendMessageToCops(COLOR,msg);//MSG TO COPS
}else{
GameTextForPlayer(playerid,"Welcome",2500,3);
}
return 1;
}
return 1;
}
I Want Do Like This To Turn Function Or Off..

Код:
if(!strcmp(cmdtext, "/on", true,8))
{
///Action-Function...

if(!strcmp(cmdtext, "/off", true,8))
{
///Action-Function...
Reply
#2

On the top of your script
pawn Код:
new publicmode = 1;
Replace

pawn Код:
public OnPlayerUpdate(playerid)
{

if(IsPlayerInRangeOfPoint(playerid, 32.0, -2904.4456,472.9688,4.9141))
{
if(playerDB[playerid][specialybe] != 1)
{
new Float:burnx, Float:burny, Float:burnz; GetPlayerPos(playerid,burnx, burny, burnz); CreateExplosion(burnx, burny , burnz, 7,10.0);//Explode
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,COLOR_WHITE,"* You Ar Intruder So You Been Removed From This Place!!!.");
new msg[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"**[Security] %s Try to intrude to your police place.",name);
SendMessageToCops(COLOR,msg);//MSG TO COPS
}else{
GameTextForPlayer(playerid,"Welcome",2500,3);
}
return 1;
}
return 1;
}
With
pawn Код:
public OnPlayerUpdate(playerid)
{

if(IsPlayerInRangeOfPoint(playerid, 32.0, -2904.4456,472.9688,4.9141))
{
if(playerDB[playerid][specialybe] != 1 && publicmode == 1)
{
new Float:burnx, Float:burny, Float:burnz; GetPlayerPos(playerid,burnx, burny, burnz); CreateExplosion(burnx, burny , burnz, 7,10.0);//Explode
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,COLOR_WHITE,"* You Ar Intruder So You Been Removed From This Place!!!.");
new msg[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"**[Security] %s Try to intrude to your police place.",name);
SendMessageToCops(COLOR,msg);//MSG TO COPS
}else{
GameTextForPlayer(playerid,"Welcome",2500,3);
}
return 1;
}
return 1;
}
Now the commands
pawn Код:
if(!strcmp(cmdtext, "/on", true,8))
{
    publicmode = 1;
    return 1;
}

if(!strcmp(cmdtext, "/off", true,8))
{
    publicmode = 0;
    return 1;
}
Reply
#3

Thanks I Think Is Good But How Fix This I Add New publicmode=1;

error 017: undefined symbol "publicmode"
warning 215: expression has no effect
Reply
#4

Its

pawn Код:
new publicmode = 1;
not

pawn Код:
New publicmode=1;
Reply
#5

Now Warrning:

warning 204: symbol is assigned a value that is never used: "publicmode"
Reply
#6

Add under "OnPlayerSpawn"

pawn Код:
publicmode = 0;
Reply
#7

Now Looks Like This.

error 017: undefined symbol "publicmode"
warning 215: expression has no effect
error 017: undefined symbol "publicmode"
warning 215: expression has no effect
error 017: undefined symbol "publicmode"
warning 215: expression has no effect
Reply
#8

Maybe Can Someone Help Me ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)