SetVehicleParamsEx Problem
#5

Well I used this example for my /lock command, but I cannot figure out my newest bug. I got the lock-system to work with my company system, but cars which have private owners are now open for everybody and can be locked/unlocked by everybody. Hope you can help me:
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(Autozeug[vehicleid][locked] == true)
    {
        new name[24];
        GetPlayerName(forplayerid,name,24);
        if(Spieler[forplayerid][aktfirma] == strval(Autozeug[vehicleid][besitzer]) || !strcmp(name,Autozeug[vehicleid][besitzer])) SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0); // aktfirma is the current company-id the player is logged into, besitzer is still the owner of a car (numeric: company-id, non-numeric/string: name of owner)
        else SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
    }
    return 1;
}

// OnPlayerCommandText
    if(strcmp(cmdtext, "/lock", true) == 0)
    {
        if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, COLOR_TOMATO, "Du musst einen Wagen fahren.");
        new vehicleid = GetPlayerVehicleID(playerid), name[24];
        GetPlayerName(playerid,name,24);
        if(!strcmp(name,Autozeug[vehicleid][besitzer]) || Spieler[playerid][aktfirma] == strval(Autozeug[vehicleid][besitzer]))
        {
            if(Autozeug[vehicleid][locked] == false)
            {
                Autozeug[vehicleid][locked] = true;
                SendClientMessage(playerid, COLOR_WHITE, ColouredText("** Du hast dein Auto #FF6347abgeschlossen#FFFFFF."));
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(i == playerid) continue;
                        if(IsNumeric(Autozeug[vehicleid][besitzer]) && Spieler[i][aktfirma] == strval(Autozeug[vehicleid][besitzer])) SetVehicleParamsForPlayer(vehicleid,i,0,0);
                        else SetVehicleParamsForPlayer(vehicleid,i,0,1);
                    }
                }
            }
            else
            {
                Autozeug[vehicleid][locked] = false;
                SendClientMessage(playerid, COLOR_WHITE, ColouredText("** Du hast dein Auto #33AA33aufgeschlossen#FFFFFF."));
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(i == playerid) continue;
                        SetVehicleParamsForPlayer(vehicleid,i,0,0);
                    }
                }
            }
        }
        else SendClientMessage(playerid, COLOR_TOMATO, "Du bist nicht der Besitzer dieses Fahrzeuges.");
        return 1;
    }
Thanks
Padarom
Reply


Messages In This Thread
SetVehicleParamsForPlayer Problem - by Padarom - 11.11.2011, 05:27
Re: SetVehicleParamsEx Problem - by Stigg - 11.11.2011, 09:36
AW: SetVehicleParamsEx Problem - by Padarom - 11.11.2011, 11:45
Re: SetVehicleParamsEx Problem - by Stigg - 11.11.2011, 11:48
AW: SetVehicleParamsEx Problem - by Padarom - 11.11.2011, 14:42

Forum Jump:


Users browsing this thread: 3 Guest(s)