CMD:mycar( playerid, params[ ] ) { new vid = GetVehicleID(GetPlayerVehicleID(playerid)); //-------------------------------------------------------------------------- if(IsPlayerInAnyVehicle( playerid ) ) return SendError2( playerid, "{FFFFFF}Please exit your current vehicle, to call your vehicle !", "{FFFFFF}Trebuie sa iesi din vehicul pentru a folosi comanda respectiva" ); //-------------------------------------------------------------------------- if(CosminInfo[playerid][CarOwner]) return SendError2(playerid, "{FFFFFF}This car isn't yours!", "{FFFFFF}Aceasta masina nu este a ta"); //-------------------------------------------------------------------------- if(GetPlayerVehicles(playerid) == 0) return SendError2(playerid, "{FFFFFF}You don't have a personal car", "{FFFFFF}Nu ai o masina personala"); //-------------------------------------------------------------------------- if(sscanf(params, "i", vid)) return SendUsage(playerid, "/MyCar [Car ID]"); //-------------------------------------------------------------------------- new Float:X, Float:Y, Float:Z, Float:A ; GetPlayerPos( playerid, X, Y, Z ); GetPlayerFacingAngle( playerid, A ); SetVehiclePos( vid, X, Y, Z ); SetVehicleZAngle( vid, A ); PutPlayerInVehicle( playerid, vid, 0 ); GameTextForPlayer( playerid, "~w~~h~You spawned your~n~~r~~h~personal vehicle.", 4000, 4); return ( 1 ); }
I recommend placing your command on the label
Код HTML:
|
When I write,ex: /mycar 23,that work,and should not,cause,is not my personal car.
|
Of course "/mycar 23" works because you don't have any checks after sscanf
You should check if the given vehicleid is one of the personal vehicles Also using the vehicleid as identifier is questionable, use the index of your data structue instead |