new rand = random(sizeof(mLocations[])); pInfo[playerid][LocIDName1] = mLocations[rand][Name]; rand = random(sizeof(mLocations[])); pInfo[playerid][LocIDName2] = mLocations[rand][Name]; format(string, sizeof(string), ""COL_YELLOW"WORK:"COL_WHITE" Deliver supplies from "COL_YELLOW"%s"COL_WHITE" to "COL_YELLOW"%s"COL_WHITE".",pInfo[playerid][LocIDName1],pInfo[playerid][LocIDName2]); SendClientMessage(playerid, -1, string); SendClientMessage(playerid, -1, ""COL_YELLOW"WORK:"COL_WHITE" You can always stop work using /stopwork.");
enum PlayerVariables { LocIDName1[128], LocIDName2[128] }; new pInfo[MAX_PLAYERS][PlayerVariables];
enum MissionLocations { Name[128], Float:X, Float:Y, Float:Z }; new mLocations[][MissionLocations] = { {"LS Construction Site", 1859.0, -1314.0, 14.0}, {"SF Construction Site", -2083.0, 209.0, 35.5}, {"LV Construction Site", 2708.0, 878.0, 10.0} };
CMD:work(playerid, params[]) { new vid = GetPlayerVehicleID(playerid), string[128]; if(pInfo[playerid][InWork] == true) return SendClientMessage(playerid, -1, ""COL_GRAY"You are still in the middle of a work!:"); //if(GetVehicleModel(vid) != 403 || GetVehicleModel(vid) != 515 || GetVehicleModel(vid) != 514) return SendClientMessage(playerid, -1, ""COL_GRAY"You must be in a truck to start working!"); if(!IsTrailerAttachedToVehicle(vid)) return SendClientMessage(playerid, -1, ""COL_GRAY"You need to have a trailer attached to your vehicle to start working!"); new rand = random(sizeof(mLocations[])); format(pInfo[playerid][LocIDName1], sizeof(pInfo[playerid][LocIDName1]), "%s", mLocations[rand][Name]); pInfo[playerid][X1] = mLocations[rand][X]; pInfo[playerid][Y1] = mLocations[rand][Y]; pInfo[playerid][Z1] = mLocations[rand][Z]; rand = random(sizeof(mLocations[])); format(pInfo[playerid][LocIDName2], sizeof(pInfo[playerid][LocIDName2]), "%s", mLocations[rand][Name]); pInfo[playerid][X2] = mLocations[rand][X]; pInfo[playerid][Y2] = mLocations[rand][Y]; pInfo[playerid][Z2] = mLocations[rand][Z]; format(string, sizeof(string), ""COL_YELLOW"WORK:"COL_WHITE" Deliver supplies from "COL_YELLOW"%s"COL_WHITE" to "COL_YELLOW"%s"COL_WHITE".",pInfo[playerid][LocIDName1],pInfo[playerid][LocIDName2]); SendClientMessage(playerid, -1, string); SendClientMessage(playerid, -1, ""COL_YELLOW"WORK:"COL_WHITE" You can always stop work using /stopwork."); SetPlayerCheckpoint(playerid, pInfo[playerid][X1], pInfo[playerid][Y1], pInfo[playerid][Z1], 7); pInfo[playerid][VehicleID] = vid; pInfo[playerid][VehicleTrailerID] = GetVehicleTrailer(vid); pInfo[playerid][InWork] = true; return 1; }
CMD:work(playerid, params[])
{
new vid = GetPlayerVehicleID(playerid), string[512];
if(pInfo[playerid][InWork] == true) return SendClientMessage(playerid, -1, ""COL_GRAY"You are still in the middle of a work!:");
//if(GetVehicleModel(vid) != 403 || GetVehicleModel(vid) != 515 || GetVehicleModel(vid) != 514) return SendClientMessage(playerid, -1, ""COL_GRAY"You must be in a truck to start working!");
if(!IsTrailerAttachedToVehicle(vid)) return SendClientMessage(playerid, -1, ""COL_GRAY"You need to have a trailer attached to your vehicle to start working!");
new rand = random(sizeof(mLocations[]));
format(pInfo[playerid][LocIDName1], sizeof(pInfo[playerid][LocIDName1]), "%s", mLocations[rand][Name]);
pInfo[playerid][X1] = mLocations[rand][X];
pInfo[playerid][Y1] = mLocations[rand][Y];
pInfo[playerid][Z1] = mLocations[rand][Z];
rand = random(sizeof(mLocations[]));
format(pInfo[playerid][LocIDName2], sizeof(pInfo[playerid][LocIDName2]), "%s", mLocations[rand][Name]);
pInfo[playerid][X2] = mLocations[rand][X];
pInfo[playerid][Y2] = mLocations[rand][Y];
pInfo[playerid][Z2] = mLocations[rand][Z];
format(string, sizeof(string), ""COL_YELLOW"WORK:"COL_WHITE" Deliver supplies from "COL_YELLOW"%s"COL_WHITE" to "COL_YELLOW"%s"COL_WHITE".",pInfo[playerid][LocIDName1],pInfo[playerid][LocIDName2]);
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, -1, ""COL_YELLOW"WORK:"COL_WHITE" You can always stop work using /stopwork.");
SetPlayerCheckpoint(playerid, pInfo[playerid][X1], pInfo[playerid][Y1], pInfo[playerid][Z1], 7);
pInfo[playerid][VehicleID] = vid;
pInfo[playerid][VehicleTrailerID] = GetVehicleTrailer(vid);
pInfo[playerid][InWork] = true;
return 1;
}
I'm not even sure if these people that try to help know pawn at all.
problem is here pInfo[playerid][LocIDName2] = mLocations[rand][Name]; This doesn't copy strings into eachother, just the first letter, there are strcat, memcpy and strcpy for this job. |
CMD:work(playerid, params[]) { new vid = GetPlayerVehicleID(playerid), string[512]; if(pInfo[playerid][InWork] == true) return SendClientMessage(playerid, -1, ""COL_GRAY"You are still in the middle of a work!:"); //if(GetVehicleModel(vid) != 403 || GetVehicleModel(vid) != 515 || GetVehicleModel(vid) != 514) return SendClientMessage(playerid, -1, ""COL_GRAY"You must be in a truck to start working!"); if(!IsTrailerAttachedToVehicle(vid)) return SendClientMessage(playerid, -1, ""COL_GRAY"You need to have a trailer attached to your vehicle to start working!"); new rand = random(sizeof(mLocations[])); strcat(pInfo[playerid][LocIDName1], mLocations[rand][Name]); pInfo[playerid][X1] = mLocations[rand][X]; pInfo[playerid][Y1] = mLocations[rand][Y]; pInfo[playerid][Z1] = mLocations[rand][Z]; rand = random(sizeof(mLocations[])); strcat(pInfo[playerid][LocIDName2], mLocations[rand][Name]); pInfo[playerid][X2] = mLocations[rand][X]; pInfo[playerid][Y2] = mLocations[rand][Y]; pInfo[playerid][Z2] = mLocations[rand][Z]; format(string, sizeof(string), ""COL_YELLOW"WORK:"COL_WHITE" Deliver supplies from "COL_YELLOW"%s"COL_WHITE" to "COL_YELLOW"%s"COL_WHITE".",pInfo[playerid][LocIDName1],pInfo[playerid][LocIDName2]); SendClientMessage(playerid, -1, string); SendClientMessage(playerid, -1, ""COL_YELLOW"WORK:"COL_WHITE" You can always stop work using /stopwork."); SetPlayerCheckpoint(playerid, pInfo[playerid][X1], pInfo[playerid][Y1], pInfo[playerid][Z1], 7); pInfo[playerid][VehicleID] = vid; pInfo[playerid][VehicleTrailerID] = GetVehicleTrailer(vid); pInfo[playerid][InWork] = true; return 1; }
CMD:work(playerid, params[]) { new vid = GetPlayerVehicleID(playerid), string[512]; if(pInfo[playerid][InWork] == true) return SendClientMessage(playerid, -1, ""COL_GRAY"You are still in the middle of a work!:"); //if(GetVehicleModel(vid) != 403 || GetVehicleModel(vid) != 515 || GetVehicleModel(vid) != 514) return SendClientMessage(playerid, -1, ""COL_GRAY"You must be in a truck to start working!"); if(!IsTrailerAttachedToVehicle(vid)) return SendClientMessage(playerid, -1, ""COL_GRAY"You need to have a trailer attached to your vehicle to start working!"); new rand = random(sizeof(mLocations[])); strcpy(pInfo[playerid][LocIDName1], mLocations[rand][Name]); pInfo[playerid][X1] = mLocations[rand][X]; pInfo[playerid][Y1] = mLocations[rand][Y]; pInfo[playerid][Z1] = mLocations[rand][Z]; rand = random(sizeof(mLocations[])); strcpy(pInfo[playerid][LocIDName2], mLocations[rand][Name]); pInfo[playerid][X2] = mLocations[rand][X]; pInfo[playerid][Y2] = mLocations[rand][Y]; pInfo[playerid][Z2] = mLocations[rand][Z]; format(string, sizeof(string), ""COL_YELLOW"WORK:"COL_WHITE" Deliver supplies from "COL_YELLOW"%s"COL_WHITE" to "COL_YELLOW"%s"COL_WHITE".",pInfo[playerid][LocIDName1],pInfo[playerid][LocIDName2]); SendClientMessage(playerid, -1, string); SendClientMessage(playerid, -1, ""COL_YELLOW"WORK:"COL_WHITE" You can always stop work using /stopwork."); SetPlayerCheckpoint(playerid, pInfo[playerid][X1], pInfo[playerid][Y1], pInfo[playerid][Z1], 7); pInfo[playerid][VehicleID] = vid; pInfo[playerid][VehicleTrailerID] = GetVehicleTrailer(vid); pInfo[playerid][InWork] = true; return 1; }