SA-MP Forums Archive
Random Deliverys Help - 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: Random Deliverys Help (/showthread.php?tid=70012)



Random Deliverys Help - StrickenKid - 22.03.2009

Ok ive been trying to figure this out for an hour but i cant seem to get it working, heres the code:

pawn Код:
//on the top
enum dpInfo
{
    dpName[24],
    Float:dp_x,
    Float:dp_y,
    Float:dp_z,
};
new Float:DeliveryPoints[][dpInfo] = {
    {"Shody Used Autos",1664.9709,1805.9022,10.8203},
    {"Las Venturas Hospital",1605.6575,1844.7755,10.8203},
    {"Las Venturas Airport",1716.4977,1453.9136,10.8007},
    {"Las Venturas City Hall",2427.5752,1123.2358,10.6719}
};

new DeliveryItemNames[][32] = {
    {"Delivery item 1"},
    {"Delivery item 2"},
    {"Delivery item 3"},
    {"Delivery item 4"}
};

//onplayercmd

  if(strcmp(cmdtext,"/delivery",true)==0)
  {
    new vehicleid = GetPlayerVehicleID(playerid);
        new CarID = GetVehicleModel(vehicleid);
        if(CarID == 515 || CarID == 514 || CarID == 514)
        {
          new rand = random(sizeof(DeliveryPoints));
          new nrand = random(sizeof(DeliveryItemNames));
          SetPlayerRaceCheckpoint(playerid,2,DeliveryPoints[rand][dp_x],DeliveryPoints[rand][dp_y],DeliveryPoints[rand][dp_z],0.0,0.0,0.0,10);
          DeliveryPoints[rand][dpName] = DeliveringLocation[playerid];
          DeliveryItemNames[nrand] = DeliveringItems[playerid];
          format(string,sizeof(string),"(TRUCKERS): %s (%d) is now delivering %s to %s",ReturnPlayerName(playerid),playerid,DeliveryItemNames[nrand],DeliveryPoints[rand][dpName]);
          SendClientMessageToAll(COLOR_YELLOW,string);
        }
    return 1;
    }
im getting "(TRUCKERS): Name (ID) is now delivering to "
and no names show up.
any help is appreciated!

EDIT: i forgot to add, the race checkpoints ARE spawning on the map so i know that's right its just the names that don't show up


Re: Random Deliverys Help - StrickenKid - 22.03.2009

*BUMP*
Anyone? please im waiting on this....


Re: Random Deliverys Help - StrickenKid - 22.03.2009

*BUMP 2*
Sorry for tripple posting but i still cant figure this out can someone please help!!!


Re: Random Deliverys Help - StrickenKid - 22.03.2009

seriously.... no one will help.....


Re: Random Deliverys Help - masterhix - 22.03.2009

lol i would help but i don't know


Re: Random Deliverys Help - StrickenKid - 22.03.2009

ok, thanks for posting though, no one else even posted to say anything =/


Re: Random Deliverys Help - SpiderPork - 22.03.2009

GetPlayerName


Re: Random Deliverys Help - StrickenKid - 22.03.2009

Quote:
Originally Posted by ʞɹod ɹǝpıds || SpiderPork
GetPlayerName
uhh whats that got to do with anything?


Re: Random Deliverys Help - SpiderPork - 22.03.2009

Quote:
Originally Posted by <__Ethan__>
EDIT: i forgot to add, the race checkpoints ARE spawning on the map so i know that's right its just the names that don't show up
You have to use GetPlayerName before using it in a string.
Example:

pawn Код:
new string[128], name[MAX_PLAYER_NAME];
format(string, sizeof(string), "%s has joined the server.", name);
SendClientMessageToAll(RED, string);
This wouldn't work without GetPlayerName.

You'd need this:
pawn Код:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has joined the server.", name);
SendClientMessageToAll(RED, string);



Re: Random Deliverys Help - yezizhu - 22.03.2009

new FloateliveryPoints -> new DeliveryPoints(no matter?idk)

and

in OnPlayerCommandText
,under SetPlayerRaceCheckpoint

left = right,will clean delivery name due to logical error(exchange them)