Command does only 4/6 functions XD REP+ -
erminpr0 - 25.11.2013
[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;
}
Re: Command does only 4/6 functions XD REP+ -
erminpr0 - 25.11.2013
Help me someone, Konstantinos, and other good scripters please help

REP +
Re: Command does only 4/6 functions XD REP+ -
Voxel - 25.11.2013
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
Re: Command does only 4/6 functions XD REP+ -
erminpr0 - 25.11.2013
Omg first parametar is Admin level, to send all admins with admin lvl "1" or higher..
I used different string, didn't work aswell
Re: Command does only 4/6 functions XD REP+ -
tyler12 - 25.11.2013
Show me the GetVehicleName() function.
Re: Command does only 4/6 functions XD REP+ -
erminpr0 - 25.11.2013
GetVehicleName is not problem, it works in other codes, lik /destroythisvehicle (/dtc)
Re: Command does only 4/6 functions XD REP+ -
Konstantinos - 25.11.2013
If the last message is printed in the console, then the problem is in SendAdminMessage function.
Re: Command does only 4/6 functions XD REP+ -
erminpr0 - 25.11.2013
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
Re: Command does only 4/6 functions XD REP+ -
Konstantinos - 25.11.2013
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.
Re: Command does only 4/6 functions XD REP+ -
erminpr0 - 25.11.2013
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
}
}