Sending 'You are not a Cop!' to everyone. -
slerox - 10.06.2012
Now you might be thoughting that'd be a problem becuase I entered SendPlayerClientToAll but it isn't.
I'm a begginer, and I'm going actully very well, but I have this problem and I need your help guys.
Basiclly the code is for opening doors at the new LSPD interior which I've made, the code is based on a key KEY_ENTER and it is work pretty good.
except it gives always messages to people at everyplace, I want that people will be able to press on F and it will write them You are not a Cop! only at the point I've setted, but it doesn't work ..
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/opendoor", true))
{
if(PlayerToPoint(2, playerid,1551.7325,-1690.1208,1723.1050))
{
if (IsACop(playerid))
{
MoveObject(pddoor1,1554.59216309, -1691.42968750, 1722.10498047, 1.5);
MoveObject(pddoor2,1549.44067383, -1691.4589843, 1722.10498047, 1.5);
SetTimer("pdoor1", 5000, 0);
SendClientMessage(playerid, COLOR_GRAD2, "* The door will be closed in 5 seconds.");
ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 10.0, 0, 0, 0, 0, 0);
SetTimer("OnPlayerPressButton_Delay", 500, 0);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Cop!");
return 1;
}
return 1;
}
SendClientMessage(playerid, COLOR_GRAD2, "SERVER: Unknown command.");
return 0;
}
Re: Sending 'You are not a Cop!' to everyone. -
Randy More - 10.06.2012
pawn Код:
if(!strcmp(cmdtext, "/opendoor", true))
{
if(PlayerToPoint(2, playerid,1551.7325,-1690.1208,1723.1050))
{
if(IsACop(playerid))
{
MoveObject(pddoor1,1554.59216309, -1691.42968750, 1722.10498047, 1.5);
MoveObject(pddoor2,1549.44067383, -1691.4589843, 1722.10498047, 1.5);
SetTimer("pdoor1", 5000, 0);
SendClientMessage(playerid, COLOR_GRAD2, "* The door will be closed in 5 seconds.");
ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 10.0, 0, 0, 0, 0, 0);
SetTimer("OnPlayerPressButton_Delay", 500, 0);
return 1;
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "ERROR: You are not a cop!");
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "ERROR: You are not close to the PD door.");
return 1;
}
Re: Sending 'You are not a Cop!' to everyone. -
jessejanssen - 10.06.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/opendoor", true))
{
if(PlayerToPoint(2, playerid,1551.7325,-1690.1208,1723.1050))
{
if(IsACop(playerid))
{
MoveObject(pddoor1,1554.59216309, -1691.42968750, 1722.10498047, 1.5);
MoveObject(pddoor2,1549.44067383, -1691.4589843, 1722.10498047, 1.5);
SetTimer("pdoor1", 5000, 0);
SendClientMessage(playerid, COLOR_GRAD2, "* The door will be closed in 5 seconds.");
ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 10.0, 0, 0, 0, 0, 0);
SetTimer("OnPlayerPressButton_Delay", 500, 0);
}
else return SendClientMessage(playerid, COLOR_GRAD2, "You are not a Cop!");
}
else return SendClientMessage(playerid, COLOR_GRAD2, "You are not near the PD doors!");
}
else return SendClientMessage(playerid, COLOR_GRAD2, "SERVER: Unknown command.");
}
That should do the trick, I don't know the PlayerToPoint function ( As it's custom? At least, I have never seen it before. ) but your fault was you did put the 'else...... SendClientMessage(playerid, COLOR_GRAD2, "You are not a Cop!");' for if they weren't close enough to the doors, now it's in the right position.
Jesse
Re: Sending 'You are not a Cop!' to everyone. -
slerox - 10.06.2012
Quote:
Originally Posted by Randy More
pawn Код:
if(!strcmp(cmdtext, "/opendoor", true)) { if(PlayerToPoint(2, playerid,1551.7325,-1690.1208,1723.1050)) { if(IsACop(playerid)) { MoveObject(pddoor1,1554.59216309, -1691.42968750, 1722.10498047, 1.5); MoveObject(pddoor2,1549.44067383, -1691.4589843, 1722.10498047, 1.5); SetTimer("pdoor1", 5000, 0); SendClientMessage(playerid, COLOR_GRAD2, "* The door will be closed in 5 seconds."); ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 10.0, 0, 0, 0, 0, 0); SetTimer("OnPlayerPressButton_Delay", 500, 0); return 1; } else SendClientMessageEx(playerid, COLOR_GRAD2, "ERROR: You are not a cop!"); } else SendClientMessageEx(playerid, COLOR_GRAD2, "ERROR: You are not close to the PD door."); return 1; }
|
ERROR..
C:\Users\SleroX\Desktop\SAMP-SERVER\NEW\gamemodes\***.pwn(66957) : warning 209: function "zcmd_OnPlayerCommandText" should return a value
The line:ProxDetector(Float: f_Radius, playerid, string[],col1,col2,col3,col4,col5) {
Which it isn't part of the code..
Re: Sending 'You are not a Cop!' to everyone. -
Randy More - 10.06.2012
Make sure if you have no extra braces (( { or } )) after or before the command code.
Re : Sending 'You are not a Cop!' to everyone. -
ricardo178 - 10.06.2012
This will work:
pawn Код:
if(!strcmp(cmdtext, "/opendoor", true))
{
if(PlayerToPoint(2, playerid,1551.7325,-1690.1208,1723.1050))
{
if(IsACop(playerid))
{
MoveObject(pddoor1,1554.59216309, -1691.42968750, 1722.10498047, 1.5);
MoveObject(pddoor2,1549.44067383, -1691.4589843, 1722.10498047, 1.5);
SetTimer("pdoor1", 5000, 0);
SendClientMessage(playerid, COLOR_GRAD2, "* The door will be closed in 5 seconds.");
ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 10.0, 0, 0, 0, 0, 0);
SetTimer("OnPlayerPressButton_Delay", 500, 0);
return 1;
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "ERROR: You are not a cop!");
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "ERROR: You are not close to the PD door.");
}
Re: Sending 'You are not a Cop!' to everyone. -
slerox - 10.06.2012
Nevermind, I'm just removing the 'You are not a Cop'.
Re : Sending 'You are not a Cop!' to everyone. -
ricardo178 - 10.06.2012
Lol... Removing the bad isn't a solution.. Repairing is.
Re: Sending 'You are not a Cop!' to everyone. -
[ABK]Antonio - 10.06.2012
Quote:
Originally Posted by slerox
ERROR..
C:\Users\SleroX\Desktop\SAMP-SERVER\NEW\gamemodes\***.pwn(66957) : warning 209: function "zcmd_OnPlayerCommandText" should return a value
The line:ProxDetector(Float: f_Radius, playerid, string[],col1,col2,col3,col4,col5) {
Which it isn't part of the code..
|
Why are you using OnPlayerCommandText with zcmd?
Re: Sending 'You are not a Cop!' to everyone. -
jessejanssen - 10.06.2012
Have you tried my code? It should do the trick, and as asked above. Why would you use OnPlayerCommandText if you use ZCMD?
Jesse