Script Request Thread #5

Quote:
Originally Posted by NiZ
Посмотреть сообщение
For some reason I'm getting an error from this code.
Код:
 error 017: undefined symbol "isnull"
warning 202: number of arguments does not match definition

1 Error.
First thing I noticed is you're using SetPlayerTime wrong. I'd do it like this personally:

Код:
CMD:time(playerid, params[])
{
    new hours, minutes;
    if (sscanf(params,"p<:>dd",hours,minutes)) return SendClientMessage(playerid, -1, "{C0C0C0}Usage: /time <time id>");
    else return SetPlayerTime(playerid, hours,minutes);
}
But I kinda assume you're not including the whole code so this may not be of use.

Note 1: The warning came from you not using SetPlayerTime properly: it needs 3 arguments.
Note 2: I assume your problem with isnull arose from one of your includes. However I've never seen this before so don't take my word for it.
Note 3: I've used ******'s sscanf plugin: https://sampforum.blast.hk/showthread.php?tid=120356
Reply

Quote:
Originally Posted by kazai
Посмотреть сообщение
First thing I noticed is you're using SetPlayerTime wrong. I'd do it like this personally:

Код:
CMD:time(playerid, params[])
{
    new hours, minutes;
    if (sscanf(params,"p<:>dd",hours,minutes)) return SendClientMessage(playerid, -1, "{C0C0C0}Usage: /time <time id>");
    else return SetPlayerTime(playerid, hours,minutes);
}
But I kinda assume you're not including the whole code so this may not be of use.

Note 1: The warning came from you not using SetPlayerTime properly: it needs 3 arguments.
Note 2: I assume your problem with isnull arose from one of your includes. However I've never seen this before so don't take my word for it.
Note 3: I've used ******'s sscanf plugin: https://sampforum.blast.hk/showthread.php?tid=120356
I thought of using sscanf too, but someone earlier posted that /time command so I tried it, thanks!
Reply

Quote:
Originally Posted by Nathan_Strider
Посмотреть сообщение
how do i make a command /giveweapon [playerid,name] [weaponid] [ammo]
for lvl 5 admins and over
dcmd

Try this:
On Callback: OnPlayerCommandText:

pawn Код:
dcmd(giveweapon,10,cmdtext);
Somewhere In your Script:
pawn Код:
dcmd_giveweapon(playerid, cmdtext[])
{
    new tmp[256], index;
    new lookupid, weapon, wname[64];
    tmp = strtok(cmdtext, index);
    if (!strlen(tmp))
    return SendClientMessage(playerid, 0xFF444499,"/givegun <playerid> <gunid>");
    lookupid = strval(tmp);
    weapon = strval(tmp);
    if (!IsPlayerConnected(lookupid))
    {
    return SendClientMessage(playerid, 0xFF444499, "Player is not connected."); }
    if (weapon < 1 || weapon > 46)
    return SendClientMessage(playerid, 0xFF444499, "Invalid weapon ID, valid id's are between 0 and 46");
    GivePlayerWeapon(lookupid, weapon, 2000);
    GetWeaponName(weapon, wname, 64);
    format(tmp, sizeof(tmp), "* Admin %s(%d) gave you a %s with 2000 ammo", PlayerName(playerid), playerid, wname);
    SendClientMessage(lookupid, 0x99FF00AA, tmp);
    return 1;
}
If you don't have strtok:

Somewhere in your script:
pawn Код:
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;
}
Reply

Quote:
Originally Posted by dr.pepper
Посмотреть сообщение
dcmd

Try this:
On Callback: OnPlayerCommandText:

pawn Код:
dcmd(giveweapon,10,cmdtext);
Somewhere In your Script:
pawn Код:
dcmd_giveweapon(playerid, cmdtext[])
{
    new tmp[256], index;
    new lookupid, weapon, wname[64];
    tmp = strtok(cmdtext, index);
    if (!strlen(tmp))
    return SendClientMessage(playerid, 0xFF444499,"/givegun <playerid> <gunid>");
    lookupid = strval(tmp);
    weapon = strval(tmp);
    if (!IsPlayerConnected(lookupid))
    {
    return SendClientMessage(playerid, 0xFF444499, "Player is not connected."); }
    if (weapon < 1 || weapon > 46)
    return SendClientMessage(playerid, 0xFF444499, "Invalid weapon ID, valid id's are between 0 and 46");
    GivePlayerWeapon(lookupid, weapon, 2000);
    GetWeaponName(weapon, wname, 64);
    format(tmp, sizeof(tmp), "* Admin %s(%d) gave you a %s with 2000 ammo", PlayerName(playerid), playerid, wname);
    SendClientMessage(lookupid, 0x99FF00AA, tmp);
    return 1;
}
If you don't have strtok:

Somewhere in your script:
pawn Код:
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;
}
Hell no!
  1. dcmd is slow and unstable
  2. strtok is slow as hell and should never be used by anyone
pawn Код:
CMD:giveweapon(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return false;
    if(sscanf(params, "udd", id, weaponid, ammo)
        return SendClientMessage(playerid, 0xFFFFFFFF, "SYNTAX: /giveweapon [nick/id] [weaponid] [ammo]);
    if(id == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, 0xFFFFFFFF, "
ERROR: You specified an invalid player ID.");
    // You may want to run a check to make sure the admin is using a valid weapon ID here.
   
    new string[128];
    GivePlayerWeapon(id, weaponid, ammo);
    format(string, sizeof(string), "
%s(%d) has given you weapon ID %d with %d ammo.", GetName(playerid), playerid, weaponid, ammo);
    SendClientMessage(id, 0xFFFFFFFF, string);
    format(string, sizeof(string), "
You have given %s(%d) weapon ID %d with %d ammo.", GetName(id), id, weaponid, ammo);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}

stock GetName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}
You will need the ZCMD and sscanf include files. This code is untested, therefore I make no guarantee that it will work properly, it should however.
Reply

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Hell no!
  1. dcmd is slow and unstable
  2. strtok is slow as hell and should never be used by anyone
pawn Код:
CMD:giveweapon(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return false;
    if(sscanf(params, "udd", id, weaponid, ammo)
        return SendClientMessage(playerid, 0xFFFFFFFF, "SYNTAX: /giveweapon [nick/id] [weaponid] [ammo]);
    if(id == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, 0xFFFFFFFF, "
ERROR: You specified an invalid player ID.");
    // You may want to run a check to make sure the admin is using a valid weapon ID here.
   
    new string[128];
    GivePlayerWeapon(id, weaponid, ammo);
    format(string, sizeof(string), "
%s(%d) has given you weapon ID %d with %d ammo.", GetName(playerid), playerid, weaponid, ammo);
    SendClientMessage(id, 0xFFFFFFFF, string);
    format(string, sizeof(string), "
You have given %s(%d) weapon ID %d with %d ammo.", GetName(id), id, weaponid, ammo);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}

stock GetName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}
You will need the ZCMD and sscanf include files. This code is untested, therefore I make no guarantee that it will work properly, it should however.
Ok you're right, sscanf and zcmd is better. I just don't use it.. I'm starting to though.. Thanks..
Reply

hey guys i just need a little script that shows if player from team 1 reach the checkpoint & there is a time start to win the match like please wait 20 second to put the bomb then other player reach that checkpoint it wont show the time because there is already a player @ that checkpoint.

so how do i check that?

thanks for ur help
Reply

Quote:
Originally Posted by Tachibana
View Post
You can find shite loads of these filescripts in filescript section mate.
I have looked through all of them. All the drugs filter scripts don't have /sell drug. If you find one can you send me the link or if you know one? Thanks
Reply

Quote:
Originally Posted by Jonesy96
View Post
I have looked through all of them. All the drugs filter scripts don't have /sell drug. If you find one can you send me the link or if you know one? Thanks
Oh well yea they dont have it due I think they are ment to be made for DM/FreeRoam
Reply

looking for a fs that has cars all over san andreas and pickups
Reply

Quote:
Originally Posted by Loading...
View Post
looking for a fs that has cars all over san andreas and pickups
You can use this to add over 1,000 vehicles.

https://sampforum.blast.hk/showthread.php?tid=203789
Reply

pawn Code:
At the top:
new Float:x, Float:y, Float:z;


CMD:stunt(playerid, params[])
{
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid,12);
    SendClientMessage(playerid, -1,"Sekarang Anda Telah Memasuki /stunt");
    SetPVarInt(playerid, "inStunt", 1);
    return 1;
}

CMD:back(playerid, params[])
{
    SetPlayerVirtualWorld(playerid,0);
    SetPlayerPos(playerid, x, y, z); //Sets the players position to the position we saved in /stunt
    DeletePVar(playerid, "inStunt");
    return 1;
}

CMD:v(playerid, params[])
{
    new carId, Float:x, Float:y, Float:z;
    if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Usage: /v carId");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
    if(GetPVarInt(playerid, "inStunt") != 1) return SendClientMessage(playerid, -1, "anda harus berada di /stunt untuk menggunakan command ini!");
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
    SetVehicleVirtualWorld(carID, 12); // I changed this line
    SendClientMessage(playerid, -1, "Car spawned at your location!");
    return 1;
}

Not Works: vehicle not spawn at /stunt

pleaseeee help
Reply

Car buying with dialog.
Reply

I need something that checks the SetPlayerAttachedObject slots, for example:
I am using slot one, two and three, that when i do a command for another attached object that it checks wich slots are free, and when non of them are free it just says: "You cant hold anymore objects!"
Reply

Quote:
Originally Posted by Horrible
View Post
pawn Code:
At the top:
new Float:x, Float:y, Float:z;


CMD:stunt(playerid, params[])
{
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid,12);
    SendClientMessage(playerid, -1,"Sekarang Anda Telah Memasuki /stunt");
    SetPVarInt(playerid, "inStunt", 1);
    return 1;
}

CMD:back(playerid, params[])
{
    SetPlayerVirtualWorld(playerid,0);
    SetPlayerPos(playerid, x, y, z); //Sets the players position to the position we saved in /stunt
    DeletePVar(playerid, "inStunt");
    return 1;
}

CMD:v(playerid, params[])
{
    new carId, Float:x, Float:y, Float:z;
    if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Usage: /v carId");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
    if(GetPVarInt(playerid, "inStunt") != 1) return SendClientMessage(playerid, -1, "anda harus berada di /stunt untuk menggunakan command ini!");
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
    SetVehicleVirtualWorld(carID, 12); // I changed this line
    SendClientMessage(playerid, -1, "Car spawned at your location!");
    return 1;
}

Not Works: vehicle not spawn at /stunt

pleaseeee help
pawn Code:
new Pveh[MAX_PLAYERS]; // Add this outside any callback
CMD:v(playerid, params[])
{
    new carId, Float:x, Float:y, Float:z;
    if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Usage: /v carId");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
    if(GetPVarInt(playerid, "inStunt") != 1) return SendClientMessage(playerid, -1, "anda harus berada di /stunt untuk menggunakan command ini!");
    GetPlayerPos(playerid, x, y, z);
    Pveh[playerid] = CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
    SetVehicleVirtualWorld(Pveh[playerid], 12); // I changed this line
    SendClientMessage(playerid, -1, "Car spawned at your location!");
    return 1;
}
This should work
Reply

Quote:
Originally Posted by Wesley221
View Post
pawn Code:
new Pveh[MAX_PLAYERS]; // Add this outside any callback
CMD:v(playerid, params[])
{
    new carId, Float:x, Float:y, Float:z;
    if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Usage: /v carId");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
    if(GetPVarInt(playerid, "inStunt") != 1) return SendClientMessage(playerid, -1, "anda harus berada di /stunt untuk menggunakan command ini!");
    GetPlayerPos(playerid, x, y, z);
    Pveh[playerid] = CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
    SetVehicleVirtualWorld(Pveh[playerid], 12); // I changed this line
    SendClientMessage(playerid, -1, "Car spawned at your location!");
    return 1;
}
This should work
thx man................
u are really great.
u are only one can solve my problem
Reply

Quote:
Originally Posted by Calg00ne
View Post
This thread is presumably for Pawn requests only, Unknown123.
No exception for me? xD I really want it :P i don't even know if i have to use PHP or HTTP or watever lol
Reply

Could anyone have a try on making a command aka /bow [ID] so it would look like:
%s bows to %s with this color

pawn Code:
#define COLOR_ME    0xB360FDFF
(P.S. Im sure there is no animation similar to bow to someone?)
Reply

Can I have a working Progress Bar?
Reply

Sorry for repeating myself:
EDIT:Easyer to read:
I need something that checks the SetPlayerAttachedObject slots, for example:
I am using slot one, two and three, that when i do a command for another attached object that it checks wich slots are free, and when non of them are free it just says: "You cant hold anymore objects!"
Reply

https://sampwiki.blast.hk/wiki/IsPlayerA...ObjectSlotUsed

There's a wiki for a reason
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)