PDA

View Full Version : Regarding...


Jordiee
22/11/2011, 04:24 PM
Ok, I want to make a command where a player has to be near the coords but they have to be an officer..
what is the if thing again?

if(!isPlayerCop or something, sadly it is not in the script I am using :(

Jochemd
22/11/2011, 04:26 PM
You aren't even showing any script you're using... What is your job array?

Jordiee
22/11/2011, 04:27 PM
Im using VX-RP 2.

Jochemd
22/11/2011, 04:30 PM
Im using VX-RP 2.

Uhm yeah, right. That would be? Vortex Roleplay? Please just give the job array ;)

Max_Coldheart
22/11/2011, 04:30 PM
Like Jochemd saied, we need the array or we cant help.

Jordiee
22/11/2011, 04:32 PM
What do you mean the array, im new to coding >.<

Calgon
22/11/2011, 04:40 PM
vxrp2 relies on group types for groups, especially for the LSPD, as it is a group, not a job.

if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1 && playerVariables[playerid][pGroup] != 0) {

Take a look at the code above, that's from the /lspd command. It should be common sense to look for functions that use similar code, you'll be able to understand from it and try make what you're trying to do.

You'll also notice code below in the /lspd command code:

if(IsPlayerInRangeOfPoint(playerid, 5, 264.1055,109.8094,1004.6172) && GetPlayerInterior(playerid) == 10) {

The code, combined, checks if the player is in the LSPD and if they're at certain coordinates and in the correct interior.

Jordiee
22/11/2011, 04:43 PM
Ok I will try and make a command for this, and if I get errors I will post here.

Jordiee
22/11/2011, 04:53 PM
These are the errors:
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14871) : error 036: empty statement
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14872) : error 001: expected token: ")", but found ";"
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14872) : error 036: empty statement
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14874) : error 017: undefined symbol "Else"
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14877) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

And this is the command:
CMD:garage(playerid, params[]) {
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1);
if(IsPlayerInRangeOfPoint(playerid, 5, -2286.9431,2284.1853,4.9731);
SetPlayerPos(playerid, 1588.7703,-1640.3796,13.1978);
Else {
SendClientMessage(playerid, COLOR_RED, "You are not in the PD, Therefore cannot enter the garage.");
}
return 1;
}

Jordiee
22/11/2011, 05:06 PM
Bump.

Vince
22/11/2011, 05:06 PM
First 3 errors: if-statements never end with a semicolon!
4th and possibly 5th error: Else should be spelled lowercase else. Pawn is CaSe SEnSiTive.

Edit: Ow I'm sorry, I if had seen your bump I wouldn't have replied. Have some patience.

Mrki_Drakula
22/11/2011, 05:07 PM
CMD:garage(playerid, params[])
{
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1 );
{
if(IsPlayerInRangeOfPoint(playerid, 5, -2286.9431,2284.1853,4.9731));
{
SetPlayerPos(playerid, 1588.7703,-1640.3796,13.1978);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not in the PD, Therefore cannot enter the garage.");
return 1;
}
return 1;
}

Try this out. Hope it works :)

EDIT: Try now...

Jordiee
22/11/2011, 05:09 PM
Damn 8 errors:
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(5090) : error 017: undefined symbol "cmd_mobile"
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14872) : error 036: empty statement
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14874) : error 036: empty statement
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14879) : warning 225: unreachable code
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14879) : warning 217: loose indentation
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14879) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14884) : warning 225: unreachable code
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14887) : warning 225: unreachable code
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14887) : warning 217: loose indentation
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14887) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14887) : error 017: undefined symbol "cmd_serverstats"
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14887) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14887) : fatal error 107: too many error messages on one line

chrism11
22/11/2011, 05:09 PM
CMD:garage(playerid, params[]) {
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1); {
if(IsPlayerInRangeOfPoint(playerid, 5, -2286.9431,2284.1853,4.9731) {
SetPlayerPos(playerid, 1588.7703,-1640.3796,13.1978);
}
else {
SendClientMessage(playerid, COLOR_RED, "You are not in the PD, Therefore cannot enter the garage.");
}
}
return 1;
}

use this

Edit i didnt see this second page opps

Jordiee
22/11/2011, 05:13 PM
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14871) : error 036: empty statement
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14872) : error 001: expected token: ")", but found "{"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
With error 2 if I remove the { I got 4 different errors.

Jordiee
22/11/2011, 05:30 PM
These are the errors I get if I remove the { :
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(655) : warning 217: loose indentation
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(656) : warning 217: loose indentation
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14874) : error 036: empty statement
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14876) : error 001: expected token: ")", but found "-identifier-"
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14878) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\Windows\gamemodes\vx-rp.pwn(14882) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


EDIT: Can someone help me please :{

Mrki_Drakula
22/11/2011, 06:51 PM
Show me the exact (14871) and (14872) lines

Jordiee
22/11/2011, 07:11 PM
it is just:
}

on a different command right above the CMD:garage on