SA-MP Forums Archive
/rcar || /mycar problems - 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: /rcar || /mycar problems (/showthread.php?tid=124223)



/rcar || /mycar problems - jamesb93 - 29.01.2010

Hey,

Im working on commands but it seems to be having troubles. The basis is that the person can own only 2 vehicles, They can do /mycars and see what they're vehicles they own's vehid. Then they can do /rcar [vehid] to bring it to them. They are defined the owner of the car in vInfo[vehid][vOwnerId].

This is what I got so far.

pawn Код:
dcmd_mycars(playerid,params[])
{
    #pragma unused params
    new string[126];
    for(new v=1;v<MAX_VEHICLES;v++)
    {
        if(vInfo[v][vOwnerId] == PlayerInfo[playerid][pSQLId]) return SendClientMessage(playerid,0x33CCFFFF,"You dont own a vehicle(s)");
        {
      format(string, sizeof(string), "Veh1: %d || Veh2: %d", v, v);
            SendClientMessage(playerid, COLOR_ORANGE, string);
        }
        return 1;
    }
    return 1;
}
//-----------------------------------------------------SQL, retrive car----------------------------------------------------------------------------------------
dcmd_rcar(playerid,params[])
{
    new
        Float:x,
        Float:y,
        Float:z;
    for(new v=1;v<MAX_VEHICLES;v++)
    {
        if(sscanf(params,"i", v)) return SendClientMessage(playerid,0x33CCFFFF,"Usage: /rcar [vehid]");
        if(vInfo[v][vOwnerId] == PlayerInfo[playerid][pSQLId]) return SendClientMessage(playerid,0x33CCFFFF,"You dont own that vehicle");
        {
            GetPlayerPos(playerid,x,y,z);
            SetVehiclePos(v,x,y,z);
            PutPlayerInVehicle(playerid,v,0);
        }
        return 1;
    }
    return 1;
}
Can someone correct me?