20.03.2011, 00:13
Been playing about and got a few friends to join my server to help test out my script only to find out that my /v is bugged. Like if one person spawns a vehicle another persons vehicle gets deleted, as if the ID's were conflicting or something. so could anybody take a look at my code and help me out please?
Код:
dcmd_v(playerid, params[]) { new Index; new tmp[256]; tmp = strtok(params,Index); new tmp2[256]; tmp2 = strtok(params,Index); new tmp3[256]; tmp3 = strtok(params,Index); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /v [name] [color1] [color2]"); new car; new string[128]; new colour1, colour2; if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp); if(car < 400 || car > 611) return SendClientMessage(playerid, BALTA, "ERROR: Invalid modelid/carname!"); if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2); if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3); if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]); new Float:X,Float:Y,Float:Z; new Float:Angle; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); SpawnedVehicles[playerid] = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0); format(string, sizeof(string), "You Spawned a %s", VehicleNames[car-400], car, colour1, colour2); LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(playerid)); SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(playerid)); return SendClientMessage(playerid,COLOR_ORANGE,string); }