Help me about script private vehicle
#1

Well this is my code
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
	{
	    if(vehicleid == valo)
	    {
	        if(strcmp(PlayerName(playerid)," Valo_Xhan", true) != 0)
	        {
	            RemovePlayerFromVehicle(playerid);
	            SendClientMessage(playerid, COLOR_GREEN, "This is Valo vehicle!")
         	}
		}
        stock PlayerName(playerid)
		{
			new PlrName[MAX_PLAYER_NAME];
			GetPlayerName(playerid,PlrName,sizeof(PlrName));
			return PlrName;
		}
		return 1;
	}
}
And ya' i got 5 error

Код:
D:\Test server\filterscripts\Valox.pwn(118) : error 017: undefined symbol "PlayerName"
D:\Test server\filterscripts\Valox.pwn(121) : error 029: invalid expression, assumed zero
D:\Test server\filterscripts\Valox.pwn(121) : warning 215: expression has no effect
D:\Test server\filterscripts\Valox.pwn(121) : error 001: expected token: ";", but found ")"
D:\Test server\filterscripts\Valox.pwn(121) : error 029: invalid expression, assumed zero
D:\Test server\filterscripts\Valox.pwn(121) : fatal error 107: too many error messages on one line
Reply
#2

Try this
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(vehicleid == valo)
        {
            if(strcmp(PlayerName(playerid)," Valo_Xhan", true) != 0)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREEN, "This is Valo vehicle!")
            }
        }
    }
    return 1;
}

stock PlayerName(playerid)
{
    new PlrName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,PlrName,sizeof(PlrName));
    return PlrName;
}
stock's / funcrion's is not supposed to be in other Callbacks
Reply
#3

I got this 2 error now

Код:
D:\Test server\filterscripts\Xo.pwn(125) : error 001: expected token: ";", but found "}"
D:\Test server\filterscripts\Xo.pwn(137) : error 010: invalid function or declaration
Reply
#4

pawn Код:
SendClientMessage(playerid, COLOR_GREEN, "This is Valo vehicle!")
//to
SendClientMessage(playerid, COLOR_GREEN, "This is Valo vehicle!");
You forgot the ;

and what line is 137?
Reply
#5

THis is the error in line 137

Код:
new PlrName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,PlrName,sizeof(PlrName));
    return PlrName;
}
	return 1; <<< line 137
}
Reply
#6

pawn Код:
SendClientMessage(playerid, COLOR_GREEN, "This is Valo vehicle!");
Reply
#7

Well i know that.i confuse with line 137. this is the code

Код:
stock PlayerName(playerid)
{
    new PlrName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,PlrName,sizeof(PlrName));
    return PlrName;
}
	return 1; <<< line 137
}
Reply
#8

remove

pawn Код:
return 1; <<< line 137
}
So then your code should be this:
pawn Код:
stock PlayerName(playerid)
{
    new PlrName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,PlrName,sizeof(PlrName));
    return PlrName;
}
Reply
#9

Thanks Lorenc
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)