SA-MP Forums Archive
Help me about script private vehicle - 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 me about script private vehicle (/showthread.php?tid=262422)



Help me about script private vehicle - Aizen - 17.06.2011

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



Re: Help me about script private vehicle - Laronic - 17.06.2011

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


Re: Help me about script private vehicle - Aizen - 18.06.2011

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



Re: Help me about script private vehicle - Laronic - 18.06.2011

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?


Re: Help me about script private vehicle - Aizen - 18.06.2011

THis is the error in line 137

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



Re: Help me about script private vehicle - Deskoft - 18.06.2011

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



Re: Help me about script private vehicle - Aizen - 18.06.2011

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
}



Re: Help me about script private vehicle - Lorenc_ - 18.06.2011

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;
}



Re: Help me about script private vehicle - Aizen - 18.06.2011

Thanks Lorenc