03.05.2013, 11:31
I have a script as follows:
And I need to use variable Packcar[vid] outsize a CMD:th{}. But it don't work. I am a Pawno Beginner. Plz help me solve this problem. Thanks.
Code:
CMD:th(playerid, params[]) { for(new vid; vid<MAX_VEHICLES; vid++) { new Float:vx, Float:vy, Float:vz; GetVehiclePos(vid,vx,vy,vz); GetXYBehindCar(vid,vx,vy,3.5); if(IsPlayerInRangeOfPoint(playerid,2.5,vx,vy,vz)) { CarPack = GetPlayerVehicleID(playerid) if(IsThueXeVehicle(vid)) { if(PackCar[vid] == 5) return SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: Xe nay da bo du so hang."); SetPlayerSpecialAction(playerid,0); ClearAnimations(playerid); ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 1); RemovePlayerAttachedObject(playerid,0); PackCar[CarPack]++; LayPack = PackCar[vid]; PlayerInfo[playerid][pPackTruonghop] = 0; if(PackCar[vid] == 1) { Vehicle[playerid][0] = CreateObject(1220,0,0,-1000,0,0,0,100); AttachObjectToVehicle(Vehicle[playerid][0], vid, 0.450000,-1.049999,0.300000,0.000000,0.000000,0.000000); return 1; } if(PackCar[vid] == 2) { Vehicle[playerid][1] = CreateObject(1220,0,0,-1000,0,0,0,1); AttachObjectToVehicle(Vehicle[playerid][1], vid, -0.449999,-1.049999,0.300000,0.000000,0.000000,89.099983); return 1; } if(PackCar[vid] == 3) { Vehicle[playerid][2] = CreateObject(1220,0,0,-1000,0,0,0,100); AttachObjectToVehicle(Vehicle[playerid][2], vid, -0.449999,-1.950000,0.300000,0.000000,0.000000,-67.500007); return 1; } if(PackCar[vid] == 4) { Vehicle[playerid][3] = CreateObject(1220,0,0,-1000,0,0,0,100); AttachObjectToVehicle(Vehicle[playerid][3], vid, 0.450000,-1.950000,0.300000,0.000000,0.000000,97.199974); return 1; } if(PackCar[vid] == 5) { Vehicle[playerid][4] = CreateObject(1220,0,0,-1000,0,0,0,100); AttachObjectToVehicle(Vehicle[playerid][4], vid, -0.0 (......)