SA-MP Forums Archive
How can i do that? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How can i do that? (/showthread.php?tid=167647)



How can i do that? - Ihsan_Cingisiz - 13.08.2010

Hello, i want to make my license system a bit easier to script..
Here's my script:

Quote:

new bike = GetVehicleModel(vehicleid);
new planes = GetVehicleModel(vehicleid);
new boats = GetVehicleModel(vehicleid);

if(bike == 581 || bike == 522 || bike == 461 || bike == 521 || bike == 463 || bike == 586 || bike == 468 || bike == 471) {
if(PlayerInfo[playerid][pDriveLic] == 0) {
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z);
SendClientMessage(playerid, COLOR_DARKRED, "*** You don't know how to drive yet, get your license at the License Center. ((/gps_licensecenter))");
}
}
else if(planes == 592 || planes == 577 || planes == 511 || planes == 512 || planes == 593 || planes == 520 || planes == 553 || planes == 476 || planes == 519 || planes == 460 || planes == 513) {
if(PlayerInfo[playerid][pFlyLic] == 0) {
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z);
SendClientMessage(playerid, COLOR_DARKRED, "*** You don't know how to fly yet, get your license at the License Center. ((/gps_licensecenter))");
}
}
else if(boats == 472 || boats == || boats == || boats == || boats == || boats == || boats == || boats == || ) {
if(PlayerInfo[playerid][pFlyLic] == 0) {
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z);
SendClientMessage(playerid, COLOR_DARKRED, "*** You don't know how to fly yet, get your license at the License Center. ((/gps_licensecenter))");
}
}
return 1;
}

This is my script to detect if the player has the license for the vehicle.
Now there are Bikes, Planes 'n' Boats. I don't want to write all the model again and again so
my question was if i can add something like this:

Quote:

new bike = GetVehicleModel(vehicleid);
bike()
{
1213;
1231321l
blablabla
}

So i can add:

Quote:

if(model != bike) {
SendClient lalblablalbla..
}

I hope someone will help me..

Thanks,
Greetings..


Re: How can i do that? - [MWR]Blood - 13.08.2010

Yeah, you can do it like that:
pawn Код:
new bike = all bike models goes here..;
There's no other way :S


Re: How can i do that? - Ihsan_Cingisiz - 13.08.2010

Quote:
Originally Posted by ikarus
Посмотреть сообщение
Yeah, you can do it like that:
pawn Код:
new bike = all bike models goes here..;
There's no other way :S
Thanks but how would my server now that bike is a vehicleid?


Re: How can i do that? - [MWR]Blood - 13.08.2010

pawn Код:
new bike = models;
if(GetVehicleModel(vehicleid)==bike)
{
...



Re: How can i do that? - Ihsan_Cingisiz - 13.08.2010

Quote:
Originally Posted by ikarus
Посмотреть сообщение
pawn Код:
new bike = models;
if(GetVehicleModel(vehicleid)==bike)
{
...
Thanks but i think i already solved it:

Quote:

new model;
new bikes = (581, 522, 461, 521, 463, 586, 468, 471);
new planes = (592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513);
new boats = (472, 473, 493, 595, 484, 430, 453, 452, 446, 454);
new copfbivehicles = (523, 430, 427, 490, 528, 596, 597, 598, 599, 601);
new ambulance = (416)

GetVehicleModel(model);

This is possible right


Re: How can i do that? - [NWA]Hannes - 13.08.2010

pawn Код:
new bikes = (581, 522, 461, 521, 463, 586, 468, 471);
new planes = (592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513);
new boats = (472, 473, 493, 595, 484, 430, 453, 452, 446, 454);
new copfbivehicles = (523, 430, 427, 490, 528, 596, 597, 598, 599, 601);
new ambulance = (416)

if(GetPlayerVehicleID(playerid) == bikes)
{
    //If entered a bike
}

else if(GetPlayerVehicleID(playerid) == planes)
{
    //If entered a plane
}



Re: How can i do that? - Mike_Peterson - 13.08.2010

Hehe i had same question thanks hannes
im sure it works for ihsan aswell if he responds :P
havent tested it though.