Random Deliverys Help
#1

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
Reply
#2

*BUMP*
Anyone? please im waiting on this....
Reply
#3

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

seriously.... no one will help.....
Reply
#5

lol i would help but i don't know
Reply
#6

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

GetPlayerName
Reply
#8

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

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);
Reply
#10

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

and

in OnPlayerCommandText
,under SetPlayerRaceCheckpoint

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


Forum Jump:


Users browsing this thread: 1 Guest(s)