How can i make commands for certain areas
#1

Hey i want to make commands for certain areas with out using isplayerinrangeofpoint i want to do somert like.

Quote:

New Isplayerinpaintball [MAX_PLAYERS]

public OnPlayerCommandText(playerid, cmdtext[])
{
//paintball
if (strcmp("/paintball", cmdtext, true, 10) == 0)
{
Isplayerinpaintball = 2;
SetPlayerPos(playerid,1220,1299,1299);
return 1;
}

if (strcmp("/refillballs", cmdtext, true, 10) == 0)
{
If isplayerinpaintball = 2;
{
Isplayerinpaintball = 2;
SetPlayerPos(playerid,1220,1299,1299);
return 1;
}
else
{
SendClientMessage(playerid,red,"error: you need to be in paintball to use this command");
}

i am wondering if there is a way to do it like that instead of isplayerinrange of point. Each time i try to make it with somert like that i all ways get errors. If any one can help ill be happy to rep.
Reply
#2

try out this:
https://sampwiki.blast.hk/wiki/Areacheck

instead of "SetPlayerHealth" you would use "Isplayerinpaintball[i] = 1"
Reply
#3

thanks but i want it so he can't use like some commands out side the area the area i want is in a virtual world cuse the area is used in a different virtual world as a bank so its in a dif virtual world but this time as paintball. I want it so when he enters the virtual world he can't use any other commands like lets say /Call seen as his phone will be in the locker room.

this is my code atm

Quote:

new Paintball[MAX_PLAYERS];

if (strcmp("/paintball", cmdtext, true, 10) == 0)
{
if(Paintball[playerid] != 1); //line 2327
}
SendClientMessage(playerid,green,"you refill you'r paint ball gun");
GivePlayerWeapon(playerid, 38, 500);
GivePlayerMoney(playerid, -1250);
return 1;
}
return 1; //line 2333
}
SendClientMessage(playerid, COLOR_RED,"Error: You have to be in paintball to use that command");
}

but when i add that code i all ways get these errors

Quote:

C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2327) : error 036: empty statement
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2329) : warning 217: loose indentation
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2333) : error 010: invalid function or declaration
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(233 : error 010: invalid function or declaration
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2342) : error 010: invalid function or declaration
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2344) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

Reply
#4

quit scripting........
Reply
#5

why.
Reply
#6

Quote:
Originally Posted by xMichaelx
Посмотреть сообщение
quit scripting........
if you'r telling me to quit scripting how do u do it then.
Reply
#7

for your world problem:
https://sampwiki.blast.hk/wiki/GetPlayerVirtualWorld

for the rest, use the correct syntax..
https://sampwiki.blast.hk/wiki/Scripting_Basics
Reply
#8

Quote:
Originally Posted by Sascha
Посмотреть сообщение
still don't understand can you give me an example please.
Reply
#9

got 2 errors and these are my 2 errors for it

Quote:

C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2327) : error 036: empty statement
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2331) : error 029: invalid expression, assumed zero
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2331) : warning 215: expression has no effect
C:\Users\lol\Desktop\sa-mp\pawno\jueix.pwn(2342) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

heres the code
Quote:

if (strcmp("/refill", cmdtext, true, 10) == 0)
{
if(paintball[playerid] != 1);
GetPlayerVirtualWorld(playerid);
GiveplayerWeapon(playerid, 38, 500);
GivePlayerMoney(playerid, -5000);
else;
SendClientMessage(playerid, red,"Error: You have to be in paintball to use this command");
return 1;
}

Reply
#10

pawn Код:
if (strcmp("/refill", cmdtext, true, 7) == 0) {
    if(paintball[playerid] != 1) {
        GetPlayerVirtualWorld(playerid);
        GiveplayerWeapon(playerid, 38, 500);
        GivePlayerMoney(playerid, -5000);
    }
    else {
        SendClientMessage(playerid, red,"Error: You have to be in paintball to use this command");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)