24.10.2016, 23:19
hey guys i have a problem with a command /carname if you have a personal car you can use /carname only for 1 car that is something that i want to change like to use that command on every personal car you have and is a bug when i log in server and i spawn my vehicle let's say my vehicle id is 213 if i put a text on it like /carname Hello , and i desppawn the vehicle and someone else is spawning a vehicle with id 213 it's having my message on it, why ?
Код HTML:
new vText;
CMD:carname(playerid, params[])
{
new text[6], szMessage[256];
new vehicleid = GetPlayerVehicleID(playerid);
if(sscanf(params, "s[50]", text)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /carname [name]");
if(NoBugText[playerid] == 1)return SendClientMessage(playerid, COLOR_LIGHTRED,"Ai deja un text pe masina foloseste /removename");
if( strcmp( GetName( playerid ), CarInfo[vDBID[vehicleid]][cOwner], true) == 0 )
{
if(PlayerInfo[playerid][pPremiumAccount] >= 1)
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) != PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_WHITE, "Nu esti intr-un vehicul.");
if( vDBID[ vehicleid ] != 0 )
{
if((gettime() - VipNameTimer[playerid]) < 120) return SendClientMessage(playerid, COLOR_GREY, "Poti sa folosesti /carname odata la 2 minute!");
NoBugText[playerid] = 1;
vText = CreateObject(19327, -2597.0762, -2638.4270, -5.3536, -87.6999, 90.4001, -87.1805);
SetObjectMaterialText(vText, text, 0, 50, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(vText, vehicleid, 0.0,-1.9, 0.3, 270.0, 0.0, 0.0);
format(szMessage, sizeof(szMessage), "{F2CF09}Text pentru vehicul setat: '%s'", text);
SendClientMessage(playerid, COLOR_YELLOW, szMessage);
VipNameTimer[playerid] = gettime();
SendClientMessage(playerid, COLOR_YELLOW, "Poti folosi /removename pentru a sterge textul.");
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "Aceasta comanda poate fi folosita doar in masina personala");
}
}
else return SendClientMessage(playerid,COLOR_WHITE,"Tu nu detii cont premium!");
}
else return SendClientMessage(playerid,COLOR_WHITE,"Acest vehicul nu iti apartine!");
return 1;
}
CMD:removename(playerid, params[])
{
new szMessage[256];
if(NoBugText[playerid] == 0)return SendClientMessage(playerid, COLOR_LIGHTRED,"Nu ai nici un text pe una din masinile personale poti folosi /carname");
if(PlayerInfo[playerid][pPremiumAccount] >= 1)
{
DestroyObject(vText);
NoBugText[playerid] = 0;
format(szMessage, sizeof(szMessage), "{F2CF09}Textul setat pe masina a fost sters cu succes.");
SendClientMessage(playerid, COLOR_WHITE, szMessage);
}
else return SendClientMessage(playerid,COLOR_WHITE,"Tu nu detii cont premium!");
return 1;
}