Help with cmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with cmd (
/showthread.php?tid=247070)
Help with cmd -
ZamaXor - 07.04.2011
I need so if player is not in turf send the message you are not in a turf.
pawn Код:
COMMAND:turf(playerid)
{
for(new i = 0; i < MAX_TURFS; i++){
if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])){
SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");}}
return 1;
}
Re: Help with cmd -
iJumbo - 07.04.2011
pawn Код:
COMMAND:turf(playerid)
{
for(new i = 0; i < MAX_TURFS; i++){
if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])){
SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");
}else{
SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");}}
return 1;
}
some like this?
Re: Help with cmd -
ZamaXor - 07.04.2011
Quote:
Originally Posted by [ISS]jumbo
pawn Код:
COMMAND:turf(playerid) { for(new i = 0; i < MAX_TURFS; i++){ if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])){ SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf."); }else{ SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");}} return 1; }
some like this?
|
This sends me 2 times the message (you are not in a turf.)
Re: Help with cmd -
iJumbo - 07.04.2011
You have try some like this?
pawn Код:
COMMAND:turf(playerid)
{
for(new i = 0; i < MAX_TURFS; i++)
{
if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
{
SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");
}
if(!IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
{
SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");
}
}
return 1;
}
and try put else if ... if not work
Re: Help with cmd -
ZamaXor - 07.04.2011
Quote:
Originally Posted by [ISS]jumbo
You have try some like this?
pawn Код:
COMMAND:turf(playerid) { for(new i = 0; i < MAX_TURFS; i++) { if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])) { SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf."); } if(!IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])) { SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf."); } } return 1; }
and try put else if ... if not work
|
same...
Respuesta: Help with cmd -
Daniel-92 - 07.04.2011
you seek this?
pawn Код:
COMMAND:turf(playerid)
{
new bool:inturf=false;
for(new i = 0; i < MAX_TURFS; i++)
{
if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])) {
inturf = true; break; }
}
if(inturf == true) SendClientMessage(playerid, 0xE0FF97FF, "you are in a turf.");
else SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");
return 1;
}