RGZ Gaming Forum


 
AcasaUltimele imaginiCăutareÎnregistrareConectare

Distribuiţi|

Centura de siguranta

Vezi subiectul anterior Vezi subiectul urmator In jos
AutorMesaj
Je|eU
Moderator
Je|eU

Rank: Moderator
Status:
Posturi : 157
Reputatie : 4
Data de Inscriere : 08/08/2014
Centura de siguranta Empty
MesajSubiect: Centura de siguranta Centura de siguranta EmptyVin Aug 08, 2014 12:44 pm

Avand in vedere faptul caci pe serverul Comunitatii noastre nu exista centura de siguranta in vehicule m-am gandit sa trec aici codul acesteia,pentru orice eventualitate (cu speranta ca va aparea cat de curand in modul actual al serverului):

La toate enum pInfo (sau aInfo) adaugam:


Cod:
Quote

pSeatBelt,


In public OnPlayerDeath(playerid, killerid, reason) adaugam:

Quote

PlayerInfo[playerid][pSeatBelt] = 0;



In public OnPlayerExitVehicle(playerid, vehicleid) adaugam:

Quote

if(PlayerInfo[playerid][pSeatBelt] == 1)
{
PlayerInfo[playerid][pSeatBelt] = 0;
new stringtosee[255];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(stringtosee, sizeof(stringtosee), "* %s si-a dat jos centura", sendername);
ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
return 1;
}



Acum la toate comenzile adaugam:

Quote

if(strcmp(cmd,"/seatbelt",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(!IsModelABike(GetPlayerVehicleID(playerid)))
{
if(PlayerInfo[playerid][pSeatBelt] == 1)
{
PlayerInfo[playerid][pSeatBelt] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
new stringtosee[255];
format(stringtosee, sizeof(stringtosee), "* %s si-a dat jos centura *", sendername);
ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
return 1;
}
PlayerInfo[playerid][pSeatBelt] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
new stringtosee[255];
format(stringtosee, sizeof(stringtosee), "* %s si-a pus centura *", sendername);
ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED,"Pe motoare nu poti folosi centura de siguranta!");
return 1;
}
}
}
return 1;
}



M-am gandit ca si membrilor Police Department le-ar prinde bine sa detina o comanda speciala cu care ar verifica soferii la purtarea centurii de siguranta:

La fel la toate comenzile adaugam:

Quote

if(strcmp(cmd, "/checkseatbelt", true) == 0 || strcmp(cmd, "/csb", true) == 0)
{
new playa;
new carrr = GetVehicleModel(playerid);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Folositi: /checkseatbelt [playerid]");
return 1;
}
if(strlen(tmp))
{
playa = ReturnUser(tmp);
}
else
{
playa = strval(tmp);
}
if(GetPlayerState(playa) == PLAYER_STATE_ONFOOT)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Aceasta persoana nu se afla intr-o masina!");
return 1;
}
if(carrr == 448 || carrr >= 461 &amp;&amp; carrr <= 463 || carrr == 468 || carrr == 471 || carrr == 481 || carrr == 501 || carrr == 510 || carrr >= 521 &amp;&amp; carrr <= 523 || carrr == 581 || carrr == 586)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Aceasta persoana nu este intr-o masina ci pe un motor!");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if (PlayerInfo[playerid][pMember] != 1 &amp;&amp; PlayerInfo[playerid][pLeader] != 1)
{
SendClientMessage(playerid,COLOR_LIGHTRED,"Nu sunteti Politist!");
return 1;
}
if (ProxDetectorS(9.0, playerid, giveplayerid))
{
new stext[255];
if(PlayerInfo[playa][pSeatBelt] == 0)
{
stext = "OFF";
}
else if(PlayerInfo[playa][pSeatBelt] == 1)
{
stext = "ON";
}
format(string, sizeof(string), "%s centura de siguranta: %s" , giveplayer , stext);
SendClientMessage(playerid,COLOR_WHITE,string);
new string2[255];
format(string2, sizeof(string2), "* %s a verificat daca %s foloseste centura de siguranta.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string2, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Aceasta persoana nu se afla langa dumneavoastra!");
}
return 1;
}
Sus In jos

Centura de siguranta

Vezi subiectul anterior Vezi subiectul urmator Sus
Pagina 1 din 1

Permisiunile acestui forum:Nu puteti raspunde la subiectele acestui forum
RGZ Gaming Forum  :: »[RGZ] Gaming :: Gta San Andreas :: Tutoriale-