Command does only 4/6 functions XD REP+
#1

[SendAdminMessage works properly in other commands, that's not the reason why is not sending..]


Hi, I have made command /veh, to create vehicle..

Код:
format(string, 128, " You have spawned vehicle| ID: %d, Model: %d", crVeh, model);
SCM(playerid,WHITE,string);
// Code above is being called, it sends me a message You have spawned...
//--------------
// Code below is NOT being called, idk why, tried to use different string, not making a sense..
format(string, 128, "Admin %s has spawned %s", RPname(playerid), GetVehicleName(model));
SendAdminMessage(1, TOMATO, string);
printf("admin %s | created vehicle %s | id: %d", RPname(playerid), GetVehicleName(model), crVeh);
I don't know why, here is my code..

pawn Код:
YCMD:veh(playerid, params[], help)
{
    #pragma unused help
    if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid,DARKRED,"[CA:RP]"gray" Admins only!");
    new model,col1,col2;
    if(sscanf(params, "iii", model, col1,col2)) return SCM(playerid, GRAY,"Usage: /veh [model] [Color1] [Color2]");
    else if(model < 400 || model> 611) return SCM(playerid, GRAY,"Wrong vehicle model (400-611)");
    new Float:x,Float:y,Float:z,crVeh,string[128];
    GetPlayerPos(playerid,x,y,z);
    crVeh = CreateVehicle(model,x,y,z,0,col1,col2,-1);
    PutPlayerInVehicle(playerid, crVeh, 0);
    CarCreated[crVeh] = 1;
    SetVehicleNumberPlate(crVeh,"Admin Car");
    format(string, 128, " You have spawned vehicle | ID: %d, Model: %d", crVeh, model);
    SCM(playerid,WHITE,string);
    format(string, 128, "Admin %s has spawned %s", RPname(playerid), GetVehicleName(model));
    SendAdminMessage(1, TOMATO, string);
    printf("admin %s | created vehicle %s | id: %d", RPname(playerid), GetVehicleName(model), crVeh);
    return 1;
}
Reply
#2

Help me someone, Konstantinos, and other good scripters please help
REP +
Reply
#3

Shouldn't
pawn Код:
SendAdminMessage(1, TOMATO, string);
//be
SendAdminMessage(-1, TOMATO, string);
And i'm not sure if you can use the same string variable twice
Reply
#4

Omg first parametar is Admin level, to send all admins with admin lvl "1" or higher..

I used different string, didn't work aswell
Reply
#5

Show me the GetVehicleName() function.
Reply
#6

GetVehicleName is not problem, it works in other codes, lik /destroythisvehicle (/dtc)
Reply
#7

If the last message is printed in the console, then the problem is in SendAdminMessage function.
Reply
#8

Nothing is being called after
Код:
 format(string, 128, " You have spawned vehicle | ID: %d, Model: %d", crVeh, model);
    SCM(playerid,WHITE,string);
neither SendAdminMessage, neither printf..

and When i type /veh 522 1 1 for first time, it returns 0 (failed to send command)
but CREATES Vehicle,
and when i /dtc and /veh 522 1 1 again
it creates but return 1 after creating (command succed)
neither sending message to ME :/


I had this prolem few weeks ago, i fixed it, I DON'T KNOW HOW, today I have changed command (Idiot me)
I HATE WHEN I FORGOT THE SOLUTION XDDDDDDDDD
Reply
#9

If it returned 0, then it'd display the SERVER: Unknown command message. In this case, the problem most likely is a run time error that stops the code from being executed so the problem is in SendAdminMessage.
Reply
#10

i mean returning 0 like sending me "(my server) Command doesn't exist! type /help for list"
BUT it Creates Vehicle,

SendAdminMessage works in any other command..

I have tried to replace SendAdminMessage in YCMD/veh to this:

pawn Код:
foreach(Player, i)
{
   if(PlayerInfo[i][pAdmin] >= 1)
   {  
      SendClientMessage(playerid, -1, "Admin %s created vehicle model %d");
      //formated ofc, but I do not have time to write it
   }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)