Faction vehicles
#1

i want to make faction cars, so I have little errors ...

I put this in OnPlayerKeyStateChange

Код:
    if(newstate == 1)
    {
      	new CarCheck = GetPlayerVehicleID(playerid);
    	if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] )
        {
            if(PlayerInfo[playerid][Clan] == 1
            {
				return 0;
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            }
        }
      	return 1;
    }
Errors:

Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(946) : error 017: undefined symbol "newstate"
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(952) : error 029: invalid expression, assumed zero
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(4083) : warning 203: symbol is never used: "Pos"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

Dafuq are you doing man! Key here means the keyboard key not the car key!
Reply
#3

Should be like this...

Код:
    if(newstate == 1)
    {
      	new CarCheck = GetPlayerVehicleID(playerid);
    	if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] )
        {
            if(PlayerInfo[playerid][Clan] == 1
            else
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            }
        }
      	return 1;
    }
And place it under:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
It will look like this:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
    if(newstate == 1)
    {
      	new CarCheck = GetPlayerVehicleID(playerid);
    	if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] )
        {
            if(PlayerInfo[playerid][Clan] == 1
            else
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            }
        }
      	return 1;
    }
Reply
#4

You are missing a bracket here
pawn Код:
if(PlayerInfo[playerid][Clan] == 1
It should be
pawn Код:
if(PlayerInfo[playerid][Clan] == 1)
Reply
#5

There's a better way to make a faction cars. Here's how i do it for my script, for example, this is my san news faction cars. Basically the NewsCars in my case starts from NewsCars[0] and goes all the way up to NewsCars[6], which'll = 7 of them. If you're working with an rp script, this way is alot easier, that way, if you want to make it where x type of car like say, 2 infernuses is a faction car, but the others ain't. This is the way to do it.

Код:
new NewsCars[7]; // This is basically the amount of Faction Cars you want for that car

		if(newcar == NewsCars[1])//News Van 2
		{
		    if(PlayerInfo[playerid][pAdmin] < 3)
		    {
		        if(PlayerInfo[playerid][pMember] != 9)
		        {
				    SendClientMessage(playerid, COLOR_LIGHTRED, "	You don't have the keys!");
	                RemovePlayerFromVehicle(playerid);
				}
			}
			return 1;
		}
Reply
#6

i put this:
Код:
    if(newstate == 1)
    {
      	new CarCheck = GetPlayerVehicleID(playerid);
    	if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] || CarCheck == GSF[6]  || CarCheck == GSF[7]  || CarCheck == GSF[8]  || CarCheck == GSF[9]  || CarCheck == GSF[10]  || CarCheck == GSF[12] || CarCheck == GSF[13] || CarCheck == GSF[14]  || CarCheck == GSF[15]    )
        {
            if(PlayerInfo[playerid][Clan] == 1)
            else
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            }
        }
      	return 1;
    }
Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(808) : error 029: invalid expression, assumed zero
Reply
#7

Which is the line 808?
Reply
#8

pawn Код:
if(newstate == 1)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] || CarCheck == GSF[6]  || CarCheck == GSF[7]  || CarCheck == GSF[8]  || CarCheck == GSF[9]  || CarCheck == GSF[10]  || CarCheck == GSF[12] || CarCheck == GSF[13] || CarCheck == GSF[14]  || CarCheck == GSF[15]    )
        {
            if(PlayerInfo[playerid][Clan] == 0)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            }
        }
        return 1;
    }
Reply
#9

Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(732) : error 032: array index out of bounds (variable "GSF")
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1342) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1372) : warning 217: loose indentation
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1510) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
line 732:
Код:
        if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] || CarCheck == GSF[6]  || CarCheck == GSF[7]  || CarCheck == GSF[8]  || CarCheck == GSF[9]  || CarCheck == GSF[10]  || CarCheck == GSF[12] || CarCheck == GSF[13] || CarCheck == GSF[14]  || CarCheck == GSF[15]    )
i resolve this error, but its bugged....im not in faction and wont to remove me from vehicle...

command:
Код:
	if(newstate == 1)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
   		if(CarCheck == GSF[0] || CarCheck == GSF[1] || CarCheck == GSF[2] || CarCheck == GSF[3] || CarCheck == GSF[4] || CarCheck == GSF[5] || CarCheck == GSF[6]  || CarCheck == GSF[7]  || CarCheck == GSF[8]  || CarCheck == GSF[9]  || CarCheck == GSF[10] || CarCheck == GSF[11]  || CarCheck == GSF[12] || CarCheck == GSF[13] || CarCheck == GSF[14]  )
        {
            if(PlayerInfo[playerid][Clan] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car.");
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)