SA-MP Forums Archive
Script Request Thread #5 - 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)
+--- Thread: Script Request Thread #5 (/showthread.php?tid=187229)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34


Re: Script Request Thread #5 - justsomeguy - 20.02.2011

ey i have an small request i need something like this:http://forum.sa-mp.com/showthread.ph...ghlight=speedo but with an outer layer sow it is'nt that bold as it is now


Re: Script Request Thread #5 - Kasis - 23.02.2011

Thanks Nero_3D.


Re: Script Request Thread #5 - Mean - 24.02.2011

Can't view the errors on my phone, but, do you even have strtok defined?


Re: Script Request Thread #5 - Michael@Belgium - 24.02.2011

Quote:
Originally Posted by Mean
View Post
Can't view the errors on my phone, but, do you even have strtok defined?
Yes:

pawn Code:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: Script Request Thread #5 - Mean - 24.02.2011

O, I failed, I didn't know you already got TMP, and forgot strcmp uses "cmdtext".
pawn Code:
if( !strcmp( cmdtext, "/get", cmdtext, true, 4 ) )
{
    if( !IsPlayerAdmin( playerid ) )
        return 0;
    new Index;
    tmp = strtok( cmdtext, Index );
    new giveplayerid = strval( tmp );
    if( !IsPlayerConnected( giveplayerid ) )
       return SendClientMessage( playerid, 0xAAAAAA, "Player not connected" );
    if( !strlen( tmp ) )
        return SendClientMessage( playerid, 0xAAAAAA, "USAGE: /get [ID]");
    new Float:x, Float:y, Float:z;
    GetPlayerPos( playerid, x, y, z );
    SetPlayerPos( giveplayerid, x, y, z );
    new string[ 128 ];
    new pName[ 24 ], aName[ 24 ];
    GetPlayerName( playerid, aName, 24 );
    GetPlayerName( giveplayerid, pName, 24 );
    format( string, sizeof string, "You have teleported %s to your location", pName );
    SendClientMessage( playerid, 0xAAAAAA, string );
    format( string, sizeof string, "You have been teleported to administrator %s's position", aName );
    return SendClientMessage( giveplayerid, 0xAAAAAA, string );
}



Re: Script Request Thread #5 - Michael@Belgium - 24.02.2011

Quote:
Originally Posted by Mean
View Post
O, I failed, I didn't know you already got TMP, and forgot strcmp uses "cmdtext".
pawn Code:
if( !strcmp( cmdtext, "/get", cmdtext, true, 4 ) )
{
    if( !IsPlayerAdmin( playerid ) )
        return 0;
    new Index;
    tmp = strtok( cmdtext, Index );
    new giveplayerid = strval( tmp );
    if( !IsPlayerConnected( giveplayerid ) )
       return SendClientMessage( playerid, 0xAAAAAA, "Player not connected" );
    if( !strlen( tmp ) )
        return SendClientMessage( playerid, 0xAAAAAA, "USAGE: /get [ID]");
    new Float:x, Float:y, Float:z;
    GetPlayerPos( playerid, x, y, z );
    SetPlayerPos( giveplayerid, x, y, z );
    new string[ 128 ];
    new pName[ 24 ], aName[ 24 ];
    GetPlayerName( playerid, aName, 24 );
    GetPlayerName( giveplayerid, pName, 24 );
    format( string, sizeof string, "You have teleported %s to your location", pName );
    SendClientMessage( playerid, 0xAAAAAA, string );
    format( string, sizeof string, "You have been teleported to administrator %s's position", aName );
    return SendClientMessage( giveplayerid, 0xAAAAAA, string );
}
LOL ... ok i haven't any errors/warnings but it still don't work xppp
In-game: if i type the cmd (just /get) it says:
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

When i type /get 0;
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

When i type /get 1
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

So when i start with /get it always says:
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

;o


Re: Script Request Thread #5 - Vero - 24.02.2011

Hey. I was playing campaign earlier (for some inspiration :P) and saw that SWAT can use ropes on the helicopter and slide down them. Just wondering if this is possible and if someone knows how to do it share it with me


Re: Script Request Thread #5 - maramizo - 24.02.2011

Quote:
Originally Posted by Vero
View Post
Hey. I was playing campaign earlier (for some inspiration :P) and saw that SWAT can use ropes on the helicopter and slide down them. Just wondering if this is possible and if someone knows how to do it share it with me
Lol nice idea, can be made using GetPlayerPos of the plane, then SetPlayerPos(x,y,z-#) on levels, till the player uses the command to stop it
But seriously nice idea lol.


Re: Script Request Thread #5 - BBAT - 24.02.2011

Quote:
Originally Posted by maramizo
View Post
Lol nice idea, can be made using GetPlayerPos of the plane, then SetPlayerPos(x,y,z-#) on levels, till the player uses the command to stop it
But seriously nice idea lol.
Already there https://sampforum.blast.hk/showthread.php?tid=93507


Re: Script Request Thread #5 - maramizo - 24.02.2011

Quote:
Originally Posted by Michael@Belgium
View Post
LOL ... ok i haven't any errors/warnings but it still don't work xppp
In-game: if i type the cmd (just /get) it says:
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

When i type /get 0;
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

When i type /get 1
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

So when i start with /get it always says:
'You have teleported Michael@Belgium to your location"
"You have been teleproted to adminstrator Michael@Belgium's positions"

;o
pawn Code:
if( !strcmp( cmdtext, "/get", cmdtext, true, 4 ) )
{
    if( !IsPlayerAdmin( playerid ) )
        return 0;
    new Index;
    tmp = strtok( cmdtext, Index );
    new giveplayerid = strval( tmp );
    if( !IsPlayerConnected( giveplayerid ) )
       return SendClientMessage( playerid, 0xAAAAAA, "Player not connected" );
    if( !strlen( tmp ) )
        return SendClientMessage( playerid, 0xAAAAAA, "USAGE: /get [ID]");
    if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAAAAAAA, "That player ID is not available.");
    if (playerid == giveplayerid) return SendClientMessage(playerid, 0xAAAAAA, "You cannot teleport to yourself");
    new Float:x, Float:y, Float:z;
    GetPlayerPos( playerid, x, y, z );
    SetPlayerPos( giveplayerid, x, y, z );
    new string[ 128 ];
    new pName[ 24 ], aName[ 24 ];
    GetPlayerName( playerid, aName, 24 );
    GetPlayerName( giveplayerid, pName, 24 );
    format( string, sizeof string, "You have teleported %s to your location", pName );
    SendClientMessage( playerid, 0xAAAAAA, string );
    format( string, sizeof string, "You have been teleported to administrator %s's position", aName );
    return SendClientMessage( giveplayerid, 0xAAAAAA, string );
}



Re: Script Request Thread #5 - Michael@Belgium - 25.02.2011

Quote:
Originally Posted by maramizo
View Post
pawn Code:
if( !strcmp( cmdtext, "/get", cmdtext, true, 4 ) )
{
    if( !IsPlayerAdmin( playerid ) )
        return 0;
    new Index;
    tmp = strtok( cmdtext, Index );
    new giveplayerid = strval( tmp );
    if( !IsPlayerConnected( giveplayerid ) )
       return SendClientMessage( playerid, 0xAAAAAA, "Player not connected" );
    if( !strlen( tmp ) )
        return SendClientMessage( playerid, 0xAAAAAA, "USAGE: /get [ID]");
    if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAAAAAAA, "That player ID is not available.");
    if (playerid == giveplayerid) return SendClientMessage(playerid, 0xAAAAAA, "You cannot teleport to yourself");
    new Float:x, Float:y, Float:z;
    GetPlayerPos( playerid, x, y, z );
    SetPlayerPos( giveplayerid, x, y, z );
    new string[ 128 ];
    new pName[ 24 ], aName[ 24 ];
    GetPlayerName( playerid, aName, 24 );
    GetPlayerName( giveplayerid, pName, 24 );
    format( string, sizeof string, "You have teleported %s to your location", pName );
    SendClientMessage( playerid, 0xAAAAAA, string );
    format( string, sizeof string, "You have been teleported to administrator %s's position", aName );
    return SendClientMessage( giveplayerid, 0xAAAAAA, string );
}
Nah, thanks but it's stille the same effect, but now it's : "You cannot teleport to yourself"
Even i type /get, /get 1, /get 2, ...


Re: Script Request Thread #5 - sarioookas - 05.03.2011

Hi all,i say it now my english is not very good,so sory for that .

I Really ned for someone make a simple license system with checkpoints.Could somebody show where to download it or make it pls.
this is my command of givelic

Vairavimo means - Driving i need to someone do driving example with license if someone sit in the car it's automatic take 2.000 from player and you must to go to the checkpoints when you go to the checpoints you car will respawn and it will say : Congratz,you have passed the driving test. Pls someone help me : (

Код:
COMMAND:duotilic( playerid, params[ ] )
{
	if ( PlayerInfo[ playerid ][ pFaction ] == 3 )
	{
		new
		    id,
		    result[ 128 ],
		    price;

		if ( sscanf( params, "us[128]d", id, result, price ) )
		{
			SendUsage( playerid, "/duotilic [ћaidėjo id/dalis vardo] [tipas] [kaina]" );
			SendClientMessage( playerid, COLOR_WHITE, "GALIMI TIPAI: motociklo, vairavimo, skraidymo, valties, ginklo." );
		}
		else if ( id == INVALID_PLAYER_ID ) SendClientMessage( playerid, COLOR_GREY, "   ID nerastas !" );
		else if ( !aLogged[ id ] ) SendClientMessage( playerid, COLOR_GREY, "   Ћaidėjas yra neprisijungęs." );
		else if ( !IsPlayerToPlayer( 5.0, playerid, id ) ) SendClientMessage( playerid, COLOR_GREY, "   Ћaidėjas nėra љalia tavęs." );
		else if ( price < 999 ) SendClientMessage( playerid, COLOR_GREY, "   Kaina turi būti daugiau nei $999." );
		else
		{
		    new
		        type;

			if ( !strcmp( result, "motociklo", true ) && strlen( result ) == 9 )      type = 1;
			else if ( !strcmp( result, "vairavimo", true ) && strlen( result ) == 9 ) type = 2;
			else if ( !strcmp( result, "skraidymo", true ) && strlen( result ) == 9 ) type = 3;
			else if ( !strcmp( result, "valties", true ) && strlen( result ) == 7 )   type = 4;
			else if ( !strcmp( result, "ginklo", true ) && strlen( result ) == 6 )
			{
			    if ( PlayerInfo[ playerid ][ pFRank ] < 6 )
			        return SendClientMessage( playerid, COLOR_GREY, "   Jūsų rangas permaћas, kad galėtumėte duoti љią licenziją." );

				type = 5;
			}
			else return SendClientMessage( playerid, COLOR_GREY, "   Įraљėte blogą tipo pavadinimą." );

			PlaceOfferForPlayer( id, LICENSE_OFFER, playerid, price, type );

			new
			    string[ 42 ];

			format           ( string, 41, "   Licenzijos tipas: %s licenzija.", result );
			SendClientMessage( id, COLOR_WHITE, string );
		}
	}
	else
	    SendClientMessage( playerid, COLOR_GREY, "   Jūs neesate instruktorius." );

	return true;
}



Re: Script Request Thread #5 - Kyro - 05.03.2011

iam making a car system (dont tell me to download a car system )
and i need help
how to make the player owns the car i made shops for cars and menu and it works
and load car tht works but
idk how to make the player owns it to use it in commands like /park /plate /setcolor etc...
help me please


Re: Script Request Thread #5 - antonio112 - 05.03.2011

Hello people. I want to make a script request.

Alright, so basically what I want to do, is block all Pay'n Sprays with a gate, so you can`t drive inside but what you can do is use a /paintcar command, if you're in front of Pay'n Spray, which teleports you inside the Pay'n Spray.

Now, what I need, is a timer, that occurs at 10 seconds after you typed /paintcar, which teleports you right outside the Pay'n Spray.

Here`s the /paintcar command ...

pawn Код:
CMD:paintcar( playerid, params[] )
{
    if ( !IsPlayerInRangeOfPoint( playerid, 2.0, 2074.2097, -1831.4398, 13.5469 ) )
        return 1;
       
    if ( !IsPlayerInAnyVehicle( playerid ) )
        return SendClientMessage( playerid, -1, "You must be in a "COL_LIGHTBLUE"vehicle{FFFFFF} to use this command." );
       
    if ( sscanf( params, "ii", params[ 0 ], params[ 1 ] ) )
        return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /paintcar <color 1> <color 2>" );
       
    if ( params[ 0 ] < 0 || params[ 0 ] > 252 || params[ 1 ] < 0 || params[ 1 ] > 252 )
        return SendClientMessage( playerid, -1, ""COL_LRED"VEHICLE{FFFFFF}: Invalid "COL_LIGHTBLUE"color ID{FFFFFF}. Valid "COL_LIGHTBLUE"color ID{FFFFFF}: "COL_GREEN"0 - 252" );


        new vehicleid = GetPlayerVehicleID( playerid );
        SetVehiclePos( vehicleid, 2064.2068, -1831.4756, 13.5469 );
        SetVehicleZAngle( vehicleid, 89.7299 );
        GivePlayerMoney( playerid, -1000 );
        ChangeVehicleColor( vehicleid, params[ 0 ], params[ 1 ] );
        //SendClientMessage( playerid, -1, "Your "COL_LIGHTBLUE"vehicle{FFFFFF} has been resprayed." );
    return 1;
}
Thank you.

Later edit: I did some working ... and finally somehow I made it ... So, here`s what I did.

I made a global array
pawn Код:
new PaynSprayVeh
And defined it in the CMD: paintcar
pawn Код:
PaynSprayVeh = GetPlayerVehicleID( playerid );
Made a new function:
pawn Код:
forward PayNSpray1( playerid );
public PayNSpray1( playerid )
{
    SetVehiclePos( PaynSprayVeh, 2074.2097, -1831.4398, 13.5469 );
    SendClientMessage( playerid, -1, "Your car has been fully resprayed" );
    return 1;
}
And set a timer, in the command, with:
pawn Код:
SetTimer( "PayNSpray1", 10000, 0 );
But I have another problem. So, basically, the teleport thingy works ... but I don`t receive the message from the PayNSpray1 public, this one:
pawn Код:
SendClientMessage( playerid, -1, "Your car has been fully resprayed" );
Anyone knows the problem?

Thank you.


Re: Script Request Thread #5 - Peinneon - 07.03.2011

hey, i'm new at pawn and i need a class saving script
example :
there is a class named : class A, class B, class C, class D.
a player choose class C
then the player relogs
how to make the player automatically on choosing class C ?

sorry for my bad english


Re: Script Request Thread #5 - Unknown123 - 08.03.2011

Requesting: Function
pawn Код:
stock CoolDown(playerid, name, time);
stock CoolDown(playerid, name, disable);
Example Usage:
pawn Код:
dcmd_cooldown(playerid, params[])
{
    if(CoolDown(playerid, TestCooldown, true) return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this command before the cooldown is done");
    {
        CoolDown(playerid, TestCoolDown, 60000);
        SendClientMessage(playerid, 0xFF0000FF, "Cooldown activated");
        return 1;
    }
}

dcmd_stopcooldown(playerid, params[])
{
    if(CoolDown(playerid, TestCoolDown, false) return SendClientMessage(playerid, 0xFF0000FF, "The 'TestCoolDown' is not activated");
    {
        CoolDown(playerid, TestCoolDown, false);
        SendClientMessage(playerid, 0xFF0000FF, "Cooldown stopped");
        return 1;
    }
}
Or, do you know something more simple?


Re: Script Request Thread #5 - OldDirtyBastard - 08.03.2011

EDIT: Actualy nevermind.


Re: Script Request Thread #5 - WizardCM - 09.03.2011

Hopefully this should be an easy enough script, but I want a set spawn point for people with specific names.

So, for example.

Код:
public OnPlayerSpawn(playerid)
{
   if(playerid = "WizardCM") {
         SetPlayerPos(playerid,0.0,0.0,6.0)
}
How would I go about doing this?
Any help is greatly appreciated!


AW: Re: Script Request Thread #5 - Nero_3D - 09.03.2011

Quote:
Originally Posted by WizardCM
Посмотреть сообщение
Hopefully this should be an easy enough script, but I want a set spawn point for people with specific names.

So, for example.

Код:
public OnPlayerSpawn(playerid)
{
   if(playerid = "WizardCM") {
         SetPlayerPos(playerid,0.0,0.0,6.0)
}
How would I go about doing this?
Any help is greatly appreciated!
pawn Код:
public OnPlayerSpawn(playerid)
{
    new
        name[MAX_PLAYER_NAME];
    if(strcmp(name, "WizardCM", false) == 0) {
        SetPlayerPos(playerid,0.0,0.0,6.0);
    } else if(strcmp(name, "Nic_Cramer", false) == 0) {
        SetPlayerPos(playerid,0.0,0.0,6.0);
    } else {
        //For all others
        SetPlayerPos(playerid,0.0,0.0,6.0);
    }
}



Re: AW: Re: Script Request Thread #5 - WizardCM - 09.03.2011

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    new
        name[MAX_PLAYER_NAME];
    if(strcmp(name, "WizardCM", false) == 0) {
        SetPlayerPos(playerid,0.0,0.0,6.0);
    } else if(strcmp(name, "Nic_Cramer", false) == 0) {
        SetPlayerPos(playerid,0.0,0.0,6.0);
    } else {
        //For all others
        SetPlayerPos(playerid,0.0,0.0,6.0);
    }
}
Works perfectly, thanks.

Edit: Eugh, no it doesn't. Now it sends everyone to that spawn point.